Access JSON columns
P粉345302753
P粉345302753 2024-03-30 13:17:00
0
1
465

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粉345302753
P粉345302753

reply all(1)
P粉713846879

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template