How to Return Elements from a JSON Array in MariaDB

MariaDB includes two selectors that enable us to select elements from JSON arrays:

  • [N] selects element number N in the array (for example, [0] to select the first element).
  • [*] selects all elements in the array.

These can be used in a number of JSON functions that are included in MariaDB. The following examples use them with the JSON_EXTRACT() function in order to return selected array elements.

Read more

How the JSONPath Wildcard Step (**) Works in MariaDB

When working with JSON in MariaDB, you can use JSONPath expressions to manipulate data within a JSON document.

One powerful feature that MariaDB provides is the wildcard step (**). This allows you to recursively select all child elements of the current element.

The wildcard step is a non-standard extension, and it’s also supported with the same meaning in MySQL.

Read more