Comments - JSON_ARRAY
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
NOTE: Depending on which functions you use to handle JSON, MariaDB will cast JSON_OBJECTs to (escaped) JSON string! So be mindful when putting those values into a JSON_Array.
For example:
SELECT JSON_ARRAY( JSON_OBJECT('result', 'ok'), IF( TRUE , JSON_OBJECT('result', 'escaped-string') , '' -- <-- Presumably because this IF/ELSE returns a string, the TRUE case will also be cast to string ), CASE WHEN TRUE THEN JSON_OBJECT('result', 'ok') END, CASE WHEN TRUE THEN JSON_OBJECT('result', 'escaped-string') ELSE '' -- <-- Presumably because this CASE/ELSE returns a string, the TRUE case will also be cast to string END ) AS `testcase`