Skip to content

JSON_TYPEOF

Returns the type of the root JSON element as a VARCHAR string. Possible types are object, array, string, number, boolean, and null.

sql
JSON_TYPEOF(jsonb_expression)
jsonb_expression
The JSONB value to inspect.

Examples

sql
SELECT json_typeof('{}');
-- object

SELECT json_typeof('3.14');
 json_typeof
-- number

SELECT json_typeof('"Alice"');
 json_typeof
--  string

SELECT json_typeof('null');
-- null

SELECT json_typeof(NULL);
-- <NULL>