JSON_KEYS() – Return the Keys from a JSON Object in MySQL

In MySQL, the JSON_KEYS() function returns keys from the top level value of a JSON object. The keys are returned as a JSON array, or, if a path argument is given, the top-level keys from the selected path.

You provide the JSON document as an argument to the function.

You can also (optionally) provide a second argument to specify where the “top-level” path starts from within the JSON document.

Continue reading

JSON_REPLACE() – Replace Values in a JSON Document in MySQL

In MySQL, the JSON_REPLACE() function replaces values in a JSON document and returns the result.

You provide the JSON document as the first argument, followed by the path to replace data at, followed with the value to replace the existing value with.

You can replace data at multiple places in the document if required. To do this, simply provide multiple path/value pairs as required.

Continue reading