php occ app:list --output=jsonEverything should be output as a JSON string. Eg:
{
"enabled": {
"activity": "2.5.2",
"calendar": "1.5.4",
"comments": "1.2.0",
"dav": "1.3.1",
"federatedfilesharing": "1.2.0",
"federation": "1.2.0",
"files": "1.7.2",
"files_pdfviewer": "1.1.1",
"files_sharing": "1.4.0",
"files_texteditor": "2.4.1",
"files_trashbin": "1.2.0",
"files_versions": "1.5.0",
"files_videoplayer": "1.1.0",
"firstrunwizard": "2.1",
"gallery": "17.0.0",
"logreader": "2.0.0",
"lookup_server_connector": "1.0.0",
"nextcloud_announcements": "1.1",
"notifications": "2.0.0",
"oauth2": "1.0.5",
"password_policy": "1.2.2",
"provisioning_api": "1.2.0",
"serverinfo": "1.2.0",
"sharebymail": "1.2.0",
"spreedme": "0.3.11",
"survey_client": "1.0.0",
"systemtags": "1.2.0",
"theming": "1.3.0",
"twofactor_backupcodes": "1.1.1",
"updatenotification": "1.2.0",
"workflowengine": "1.2.0"
},
"disabled": {
"admin_audit": null,
"encryption": null,
"files_external": null,
"user_external": null,
"user_ldap": null
}
}
The notice about a required update is shown that breaks the json text. Eg:
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
{
"enabled": {
"activity": "2.5.2",
"calendar": "1.5.4",
"comments": "1.2.0",
"dav": "1.3.1",
"federatedfilesharing": "1.2.0",
"federation": "1.2.0",
"files": "1.7.2",
"files_pdfviewer": "1.1.1",
"files_sharing": "1.4.0",
"files_texteditor": "2.4.1",
"files_trashbin": "1.2.0",
"files_versions": "1.5.0",
"files_videoplayer": "1.1.0",
"firstrunwizard": "2.1",
"gallery": "17.0.0",
"logreader": "2.0.0",
"lookup_server_connector": "1.0.0",
"nextcloud_announcements": "1.1",
"notifications": "2.0.0",
"oauth2": "1.0.5",
"password_policy": "1.2.2",
"provisioning_api": "1.2.0",
"serverinfo": "1.2.0",
"sharebymail": "1.2.0",
"spreedme": "0.3.11",
"survey_client": "1.0.0",
"systemtags": "1.2.0",
"theming": "1.3.0",
"twofactor_backupcodes": "1.1.1",
"updatenotification": "1.2.0",
"workflowengine": "1.2.0"
},
"disabled": {
"admin_audit": null,
"encryption": null,
"files_external": null,
"user_external": null,
"user_ldap": null
}
}
If you try to parse the command output as json, it will fail. Perhaps, there could be an extra json key that contains the notice.
Maybe we can just send the error message to stderr instead of stdin to keep it like that and have a valid json.
As a workaround the occ command has the --no-warnings option which should do exactly this, no?
Most helpful comment
Maybe we can just send the error message to stderr instead of stdin to keep it like that and have a valid json.