Bug #113514 JSON_OBJECT changes order of keys in output
Submitted: 26 Dec 2023 16:07 Modified: 27 Dec 2023 5:24
Reporter: Yoni Sade Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:8.0.35 OS:Linux
Assigned to: CPU Architecture:Any

[26 Dec 2023 16:07] Yoni Sade
Description:
JSON_OBJECT returns keys ordered by the length of their string.

How to repeat:
SELECT JSON_OBJECT('ObjectID',1,'name','Test') will return:

{"name": "test", "ObjectID": 1}

Instead of:

{"ObjectID": 1, "name": "test"}

Suggested fix:
Change behavior to return keys like they are ordered in the query.
[27 Dec 2023 5:24] MySQL Verification Team
Hello Yoni Sade,

Thank you for the report and feedback.
IMHO this is an intended behavior, please see the explanation and details by Dev in Bug #100974.

Closing this as duplicate of Bug #100974.

regards,
Umesh