MySQL Shell 8.4  /  MySQL Shell Code Execution  /  JSON Integration

5.9 JSON Integration

You can activate a JSON shell mode to help with integration of MySQL Shell with other applications that could use its functionality. In this mode, MySQL Shell accepts commands formatted as JSON documents.

To activate the JSON shell mode, define the MYSQLSH_JSON_SHELL environment variable. The following commands can then be used:

{"execute":json-string}

Executes the given code in the active MySQL Shell mode (JavaScript, Python or SQL). The code is executed as a complete unit, and an error is returned if it is incomplete.

{"command":json-string}

Executes the given MySQL Shell command (see Section 3.1, “MySQL Shell Commands”).

{"complete":{"data":json-string[, "offset": uint}}}

Determines the options for auto-completion based on the given data and the current MySQL Shell context.