mardi 14 février 2017

(AS3) Deterministic JSON String from an object?

var obj:Object = {a:"foo", b:"bar", c:"baz", d:"qux"};
trace(JSON.stringify(obj));

What determines what order the parameters of this get added to the JSON string?

I need the JSON to always be the exact same, so I can't have them being in a different order which they seem to be across different clients.

Context: I'm hashing the JSON string, and comparing the hashes on a server to determine if a client is desynced.

Aucun commentaire:

Enregistrer un commentaire