SQLite JSON Functions Cheatsheet/Update or insert a JSON field

Patch a document with json_set().

Section: Update and expand JSON

Update or insert a JSON field

sql
sql
UPDATE settings
SET config = json_set(config, '$.theme', 'dark')
WHERE user_id = 1;
Explanation

A practical way to update JSON without replacing the whole document in app code.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Update and expand JSON
Remove a JSON key
Delete one path from a document.
OpenIn sheetsqlsame section
Expand an array with json_each
Turn array elements into result rows.
OpenIn sheetsqlsame section
Join against JSON array values in a column
Search inside per-row arrays.
OpenIn sheetsqlsame section
Extract a JSON field
Read one property from a JSON document.
OpenIn sheetsql1 tag match
Use JSON operators
Read a JSON path with operator syntax.
OpenIn sheetsql1 tag match
Validate JSON text
Check whether a string contains valid JSON.
OpenIn sheetsql1 tag match