JSON函數(5.7版本才支援)
指令:json_object(函數)
作用:轉換json字串
##應用程式場景:指定資料轉換json字串範例:mysql> select json_object("name","andyqian","database","MySQL"); +---------------------------------------------------+ | json_object("name","andyqian","database","MySQL") | +---------------------------------------------------+ | {"name": "andyqian", "database": "MySQL"} | +---------------------------------------------------+ 1 row in set (0.00 sec)
mysql> select json_array("name","andyqian","database","MySQL"); +--------------------------------------------------+ | json_array("name","andyqian","database","MySQL") | +--------------------------------------------------+ | ["name", "andyqian", "database", "MySQL"] | +--------------------------------------------------+ 1 row in set (0.00 sec)
select json_valid('{"name": "andyqian", "database": "MySQL"}');
以上是MySQL如何使用JSON函數的詳細內容。更多資訊請關注PHP中文網其他相關文章!