Is it possible to use JSON_EXTRACT
with integer keys?
I want to extract [273, 140]
from below, but the SQL does not work ...
SELECT json_extract('{"1": [273, 140], "2": [273.5, 198.5], "3": [209, 191]}', '$.1');
I am trying to use syntax from https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#operator_json-column-path
I get error:
ERROR 3143 (42000): Invalid JSON path expression.
The error is around character position 3
You should use double quotes around the key if it is a number. This works:
select json_extract('{"1": [273, 140], "2": [273.5, 198.5], "3": [209, 191]}', '$."1"');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With