How do I access the values stored as JSON in the status
and date
columns?
Please see the example lines below.
{"1":{"status":true,"date":"2022-03-30"},"3":{"status":true,"date":"2022-03 -30 “}}
P粉7138468792024-03-31 09:19:18
Demo:
set @j = '{"1":{"status":true,"date":"2022-03-30"},"3":{"status":true,"date":"2022-03-30"}}'; select json_extract(@j, '$."1".status') as status; +--------+ | status | +--------+ | true | +--------+
In this case, you might accidentally need to put double quotes around "1"
to use it in a JSON path.