Available in versions: Dev (3.18)

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

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)

-- ACCESS, ASE, AURORA_MYSQL, AURORA_POSTGRES, BIGQUERY, COCKROACHDB, DB2, DERBY, EXASOL, FIREBIRD, H2, HANA, HSQLDB, 
-- INFORMIX, MEMSQL, POSTGRES, REDSHIFT, SNOWFLAKE, SQLDATAWAREHOUSE, SYBASE, TERADATA, VERTICA, YUGABYTEDB
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.18, 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