json_object
description
Syntax
VARCHAR json_object(VARCHAR,...)
生成一个包含指定Key-Value对的json object, 当Key值为NULL或者传入参数为奇数个时,返回异常错误
example
1. MySQL> select json_object();
2. +---------------+
3. | json_object() |
4. +---------------+
5. | {} |
6. +---------------+
8. MySQL> select json_object('time',curtime());
9. +--------------------------------+
10. | json_object('time', curtime()) |
11. +--------------------------------+
12. | {"time": "10:49:18"} |
13. +--------------------------------+
16. MySQL> SELECT json_object('id', 87, 'name', 'carrot');
17. +-----------------------------------------+
18. | json_object('id', 87, 'name', 'carrot') |
19. +-----------------------------------------+
20. | {"id": 87, "name": "carrot"} |
21. +-----------------------------------------+
24. MySQL> select json_object('username',null);
25. +---------------------------------+
26. | json_object('username', 'NULL') |
27. +---------------------------------+
28. | {"username": NULL} |
29. +---------------------------------+
keyword
json_object
