SQLite JSON_EACH() Function
Example
Return one row for each item in an array:
SELECT value
FROM JSON_EACH('["Emil", "Tobias", "Linus"]');
Try it Yourself »
Definition and Usage
JSON_EACH() is a table valued function. It is used in the FROM clause, and returns one row for each item in a JSON array or object.
The most useful columns are key, value and type.
Note: Read more about JSON in the SQLite JSON chapter.
Tip: Also look at JSON_TREE().
Syntax
SELECT * FROM JSON_EACH(json, path)
Parameter Values
| Parameter | Description |
|---|---|
| json | Required. The JSON text |
| path | Optional. A path to the array or object to use |
Technical Details
| Return type: | Rows |
|---|
More Examples
Example
Return the keys and values of an object:
SELECT key, value
FROM JSON_EACH('{"name": "Emil", "age": 30}');
Try it Yourself »