-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
release item: ✨ new featuresolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Milestone
Description
keys in JSON are not sorted, but ordered based on definition. This becomes apparent when iterating keys of an object. For example, in JavaScript, with an object literal:
x = { a: 0, b: 1 }
y = { b: 0, a: 1 }
for (var key in x) console.log(key)
for (var key in y) console.log(key)
for (var key in JSON.parse(JSON.stringify(x))) console.log(key)
for (var key in JSON.parse(JSON.stringify(y))) console.log(key)prints
a
b
b
a
a
b
b
a
For example, I believe most JS JITs keep separate shapes for object with the same properties but defined in different orders.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
release item: ✨ new featuresolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation