Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12

JSON predicate

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The JSON predicate can be used to check if a given expression is valid JSON

SELECT 1
FROM dual
WHERE '{}' IS JSON
AND '{' IS NOT JSON
create.selectOne()
      .where(val("{}").isJson())
      .and(val("{").isNotJson())
      .fetch();

Dialect support

This example using jOOQ:

val("{}").isJson()

Translates to the following dialect specific expressions:

DuckDB, MariaDB, MySQL

json_valid('{}')

Oracle

'{}' IS JSON

Snowflake

(check_json('{}') IS NULL)

SQLDataWarehouse, SQLServer

(isjson('{}') = 1)

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

/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website

Feedback

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

The jOOQ Logo