GET_JSON_OBJECT(<json> string, <path> string)
> SELECT get_json_object('{"a":"b"}', '$.a');b
JSON_TUPLE(<json> string, <p1> string, ..., <pn> string)
> SELECT json_tuple('{"a":1, "b":2}', 'a', 'b');1 2
TO_JSON(<expr> struct|map|array[, <option> map])
> SELECT to_json(named_struct('a', 1, 'b', 2));{"a":1,"b":2}> SELECT to_json(named_struct('time', to_timestamp('2015-08-26', 'yyyy-MM-dd')), map('timestampFormat', 'dd/MM/yyyy'));{"time":"26/08/2015"}> SELECT to_json(array(named_struct('a', 1, 'b', 2)));[{"a":1,"b":2}]> SELECT to_json(map('a', named_struct('b', 1)));{"a":{"b":1}}> SELECT to_json(map(named_struct('a', 1),named_struct('b', 2)));{"[1]":{"b":2}}> SELECT to_json(map('a', 1));{"a":1}> SELECT to_json(array((map('a', 1))));[{"a":1}]
FROM_JSON(<json> string, <schema> string[, <options> map<string, string>])
> SELECT from_json('{"a":1, "b":0.8}', 'a INT, b DOUBLE');{"a":1,"b":0.8}> SELECT from_json('{"time":"26/08/2015"}', 'time Timestamp', map('timestampFormat', 'dd/MM/yyyy'));{"time":2015-08-26 00:00:00}
SCHEMA_OF_JSON(<json> string[, <options> map<string, string>])
> SELECT schema_of_json('[{"col":0}]');ARRAY<STRUCT<`col`: BIGINT>>> SELECT schema_of_json('[{"col":01}]', map('allowNumericLeadingZeros', 'true'));ARRAY<STRUCT<`col`: BIGINT>>
JSON_ARRAY_LENGTH(<jsonArray> string)
> SELECT json_array_length('[1,2,3,4]');4> SELECT json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]');5> SELECT json_array_length('[1,2');NULL
JSON_OBJECT_KEYS(<json> string)
> SELECT json_object_keys('{}');[]> SELECT json_object_keys('{"key": "value"}');["key"]> SELECT json_object_keys('{"f1":"abc","f2":{"f3":"a", "f4":"b"}}');["f1","f2"]
本页内容是否解决了您的问题?