json_array

description

Syntax

VARCHAR json_array(VARCHAR,...)

生成一个包含指定元素的json数组,未指定时返回空数组

example

  1. MySQL> select json_array();
  2. +--------------+
  3. | json_array() |
  4. +--------------+
  5. | [] |
  6. +--------------+
  7. MySQL> select json_array(null);
  8. +--------------------+
  9. | json_array('NULL') |
  10. +--------------------+
  11. | [NULL] |
  12. +--------------------+
  13. MySQL> SELECT json_array(1, "abc", NULL, TRUE, CURTIME());
  14. +-----------------------------------------------+
  15. | json_array(1, 'abc', 'NULL', TRUE, curtime()) |
  16. +-----------------------------------------------+
  17. | [1, "abc", NULL, TRUE, "10:41:15"] |
  18. +-----------------------------------------------+
  19. MySQL> select json_array("a", null, "c");
  20. +------------------------------+
  21. | json_array('a', 'NULL', 'c') |
  22. +------------------------------+
  23. | ["a", NULL, "c"] |
  24. +------------------------------+

keyword

json_array