json
json copied to clipboard
\uXXXX ?
Nice parser, would tell there are missing unicode escape chars - my test file generated by browser had'em (see bellow). And in case U R interested in speed and memory improvements, maybe it would be better to replace StringBuilders by some string "pointer" class - my small test with 1/4TB JSON used 15,68% less memory and 9,4% less CPU. But best should be to use single string and then only some pointers to that one, but it will probably need more changes in concept, so not sure if it worth (did not changed all _ unused options in my case)... https://github.com/eltomjan/json/commit/95ce352bfaf0ecedff0b29ec1aba7a608535d1fe
var esc = "{""; for(var i=8;i<128;i++) esc += String.fromCharCode(i); esc += ""}"; var js = JSON.stringify(esc); Result: {"\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"}