SQLite 3 reference · JSON Functions

SQLite JSON_PATCH() Function

Merge one JSON object into another using RFC 7396 MergePatch: keys are added or replaced, null removes a key.

SQLite 3 Since 3.18.0

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

json_patch(target, patch)

Parameters

ParameterDescription
target The original JSON.
patch The changes.

Return value

The merged JSON text.

Examples

Override settingsTry it yourself
SELECT json_patch('{"theme":"light","lang":"en"}', '{"theme":"dark"}') AS merged;

Output

merged
{"theme":"dark","lang":"en"}
null removes a keyTry it yourself
SELECT json_patch('{"a":1,"b":2}', '{"b":null,"c":3}') AS result;

Output

result
{"a":1,"c":3}

Version history

VersionChange
SQLite 3.18.0Added

In other languages

Was this page helpful?