3 ms·
"\0" is not a valid JSON string escape sequence. However, "\u0000" is.
by maskros 3y ago
"\0" is not a valid JSON string escape sequence.
However, "\u0000" is.
- peoplefromibiza 3y agonot according to jq or firefox >> JSON.parse("\u0000") Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data <anonymous> debugger eval code:1 at that point "null" looks like a better more compatible option.
- unilynx 3y agothey're not comparable at all. you can't embed a null into a string \u0000 works fine with firefox with the proper syntax JSON.parse(`"\\u0000"`) "\u0000" and jq supports it too printf '{"null":"\u0000"}' | jq { "null": "\u0000" }
- deleted 3y ago[deleted]
- peoplefromibiza 3y ago> the proper syntax of course! I forgot to quote those quotes! (facepalm) that works. and uses a single byte too. TIL.