JSON_REMOVE
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The MySQL style JSON_REMOVE function is a function that removes a value from a JSON document, given a JSON path.
SELECT
JSON_REMOVE('{"a":1}', '$.a'),
JSON_REMOVE('{"a":1}', '$.b')
create.select(
jsonRemove(val(json("{\"a\":1}")), "$.a"),
jsonRemove(val(json("{\"a\":1}")), "$.b")).fetch();
The result would look like this:
+-------------+-------------+
| json_remove | json_remove |
+-------------+-------------+
| {} | {"a":1} |
+-------------+-------------+
Dialect support
This example using jOOQ:
jsonRemove(val(json("{\"a\":1}")), "$.a")
Translates to the following dialect specific expressions:
BigQuery
json_remove('{"a":1}', '$.a')
MariaDB 10.2+
json_remove(json_extract('{"a":1}', '$'), '$.a')
MySQL 5.7+
json_remove(cast('{"a":1}' AS json), '$.a')
Oracle 21c+
json_transform('{"a":1}', REMOVE '$.a')
SQLServer 2016+
json_modify('{"a":1}', '$.a', NULL)
SQLite
json_remove(JSON('{"a":1}'), '$.a')
Spanner
json_remove(JSON '{"a":1}', '$.a')
ASE, Access, Aurora MySQL, Aurora Postgres, ClickHouse, CockroachDB, DB2, Databricks, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB 10.0 to 10.1, MemSQL, MySQL 5.6, Oracle 18c to 20c, Postgres, Redshift, SQLDataWarehouse, SQLServer 2012 to 2014, Snowflake, Sybase, Teradata, Trino, Vertica, YugabyteDB
/* UNSUPPORTED */
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!