I have a column data consisting of {"name":["John","Peter"],id:["20","30"]}
If I do
SELECT JSON_VALUE(data,'$.name[0]') from table
it returns John but doing
SELECT JSON_VALUE(data,'$') from db
SELECT JSON_VALUE(data,'$.name') from table
returns NULL in both.
How come it does not return:
{"name":["John","Peter"],id:["20","30"]}
["John","Peter"]
As mentioned in the remarks section of the
JSON_VALUEdocumentation there is a table that says fortagsarray in the json says: Use JSON_QUERY instead.Fiddle