JSON

JSON_TYPEOF

PostgreSQLPostgreSQL

Mengembalikan tipe dari nilai JSON sebagai text string: object, array, string, number, boolean, atau null.

Tipe hasil: text

Syntax

SQL
JSON_TYPEOF(json)

Parameter

jsonjsonwajib

Nilai JSON

Contoh Penggunaan

Check JSON Type

SQL
1SELECT JSON_TYPEOF('"hello"'::json), JSON_TYPEOF('123'::json), JSON_TYPEOF('{}'::json);

Mengecek tipe berbagai nilai JSON.

Hasil
json_typeofjson_typeofjson_typeof
stringnumberobject