SQLite 3 reference · JSON Functions

SQLite JSON_REMOVE() Function

Return JSON with the elements at the given paths removed. Paths that don't exist are ignored.

SQLite 3 Since 3.9.0

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

Syntax

json_remove(json, path, ...)

Parameters

ParameterDescription
json JSON text (or JSONB).
path A path such as '$.name', '$.items[0]' or '$.items[#-1]' (last element).

Return value

The modified JSON text.

Examples

Remove a keyTry it yourself
SELECT json_remove('{"name":"Ada","password":"x","age":36}', '$.password') AS safe;

Output

safe
{"name":"Ada","age":36}
Remove array elementsTry it yourself
SELECT json_remove('[10,20,30]', '$[0]') AS without_first, json_remove('[10,20,30]', '$[#-1]') AS without_last;

Output

without_first | without_last
[20,30] | [10,20]

Version history

VersionChange
SQLite 3.9.0Added
SQLite 3.38.0Built in by default; earlier versions needed the JSON1 extension.

In other languages

Was this page helpful?