SQLite
 SQL >> Base de Dados >  >> RDS >> SQLite

SQLite json_type(): descobrindo o tipo de um elemento JSON

json_type() informa o tipo do elemento JSON mais externo ou de um caminho específico.

Sintaxe

json_type(X)
json_type(X,P)

Tipos possíveis: null, true, false, integer, real, text, array, object.

Exemplos

SELECT json_type('{ "name" : "Fluffy", "age" : 10 }');

Retorna object.

SELECT json_type('{ "name" : "Fluffy", "age" : 10 }', '$.age');

Retorna integer.

SELECT json_type('[ "Wag", 2, 1.5 ]', '$[1]');

Retorna integer.