Newer Version Available

This content describes an older version of this product. View Latest

Support for JSON Responses

Salesforce CLI commands typically display their output to the console (stdout) in non-structured, human-readable format. Messages written to the log file (stderr) are always in JSON format.

To view the console output in JSON format, specify the --json flag for a particular CLI command.

1sf org display --json

Most CLI commands support JSON output. To confirm, run the command with the --help flag to view the supported flags. The --json flag is listed under GLOBAL FLAGS.

To get JSON responses to all Salesforce CLI commands without specifying the --json flag each time, set the SF_CONTENT_TYPE environment variable.

1export SF_CONTENT_TYPE=JSON