SQLite JSON_SET() Function
Example
Change the name, and add an age:
SELECT JSON_SET('{"name": "Emil"}',
'$.name', 'Nora', '$.age', 30);
Try it Yourself »
Definition and Usage
The JSON_SET() function adds new values and changes existing values in a JSON text, and returns the new JSON.
Note: Read more about JSON in the SQLite JSON chapter.
Tip: Also look at JSON_INSERT(), JSON_REPLACE().
Syntax
JSON_SET(json, path, value, ...)
Parameter Values
| Parameter | Description |
|---|---|
| json | Required. The JSON text |
| path | Required. A JSON path, like '$.name' for a value in an object, '$[0]' for the first item in an array, or '$.a.b' for a value inside another object |
| value | Required. The value |
Technical Details
| Return type: | Text |
|---|