Hello Mario,

That is, shall we produce "canonical" JSON text at the price of
efficiency.

Or, shall the perfect implementation of JSON objects as associative
arrays be dropped?

Or, what else?


Unless JSON requiers that the keys be in some order, the correct solution is to make the check order independent. For example:

string s = CallReturningJSON();

s = replace(s,`"a":23.54`, `X`);
s = replace(s,`"b":0.0012`, `X`);
s = replace(s,`{"nested":{X,X}}`, `X`);
s = replace(s,`"goodbye":[true,"or",false,["test",42,X]]`, `X`);
s = replace(s,`"array":[12,null,{}]`, `Y`);
s = replace(s,"is\n\ngreat", `Z`);
s = replace(s,`"json":Z`, `Y`);
s = replace(s,`"hello":{Y,Y}`, `X`);
assert(s == `{X,X}`);.

--
... <IXOYE><



Reply via email to