Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
JSON_ LENGTH
On this page
The JSON_ function computes the length of a JSON map or array.
JSON_LENGTH(json)
Arguments
-
json: a valid JSON array or map.
Return Value
-
the length as an integer.
-
SQL NULL if json is not a valid JSON array or map.
Examples
SELECT JSON_LENGTH('true');
+---------------------+
| JSON_LENGTH('true') |
+---------------------+
| NULL |
+---------------------+SELECT JSON_LENGTH('[1,2,3]');
+------------------------+
| JSON_LENGTH('[1,2,3]') |
+------------------------+
| 3 |
+------------------------+SELECT JSON_LENGTH('{"alpha": 1, "beta": 2}');
+----------------------------------------+
| JSON_LENGTH('{"alpha": 1, "beta": 2}') |
+----------------------------------------+
| 2 |
+----------------------------------------+Note
A JSON or Javascript null value is distinct from SQL NULL.
Last modified: