Comments - JSON_OBJECT
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.
WARNING! JSON_OBJECT will flatten a sub JSON object/array if the key's value has conditional paths that return a non-JSON type: eg
SELECT JSON_DETAILED( JSON_OBJECT( 'key' , IF( TRUE , JSON_ARRAY(1,2) , JSON_COMPACT('XXX') ) ) )will return
{ "key": [ 1, 2 ] }but
will return
{ "key": "[1, 2]" }because the JSON array has been flattened due to the competing path returning a string ... even though it will NEVER use that path.