json_object
Description
Syntax
VARCHAR json_object(VARCHAR,...)
Generate a json object containing the specified Key-Value, an exception error is returned when Key is NULL or the number of parameters are odd.
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
