Available in versions: Dev (3.20) | Latest (3.19) | 3.18

JSON_REMOVE function

Applies to ✅ 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:

MariaDB, MySQL, SQLite

json_remove('{"a":1}', '$.a')

Oracle

json_transform('{"a":1}', REMOVE '$.a')

SQLServer

json_modify('{"a":1}', '$.a', NULL)

ASE, Access, Aurora MySQL, Aurora Postgres, BigQuery, ClickHouse, CockroachDB, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MemSQL, Postgres, Redshift, SQLDataWarehouse, Snowflake, Sybase, Teradata, Trino, Vertica, YugabyteDB

/* UNSUPPORTED */

(These are currently generated with jOOQ 3.20, see #10141), or translate your own on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo