json_array

Description

Syntax

VARCHAR json_array(VARCHAR,...)

Generate a json array containing the specified values, return empty if no values

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. +------------------------------+

keywords

json,array,json_array