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.

Read more

JSON_EXTRACT() – Return Data from a JSON Document in MySQL

In MySQL, the JSON_EXTRACT() function returns data from a JSON document. The actual data returned is determined by the path you provide as an argument.

You provide the JSON document as the first argument, followed by the path of the data to return. You can also provide multiple paths to return data from multiple places in the document.

Read more

JSON_CONTAINS() Examples in MySQL

In MySQL, the JSON_CONTAINS() function tests whether or not a specified value is found in the given JSON document or, optionally, at the specified path within the document.

If the value is found, JSON_CONTAINS() returns 1, otherwise it returns 0.

Read more

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.

Read more