3 ms·
> it'd become impossible to construct an unambigous parser/printer in Lua for this new format How so? JSON is just text; you can parse it however you like. For
by thaumasiotes 10y ago
> it'd become impossible to construct an unambigous parser/printer in Lua for this new format
How so? JSON is just text; you can parse it however you like. For example, I can write a parser that produces the byte sequence "It checks out." for any valid JSON input. A Lua JSON parser that represents objects with integer keys as maps with string keys, and a Lua JSON parser that represents objects with integer keys as sparse arrays, are both unambiguous and both correct (as to a hypothetical JSON which allowed integer keys). JSON is a format, not a Lua structure.
Even if your JSON data is
{ 10: 10, "10": "ten" }
there's no problem being able to write an unambiguous parser. Define what your parser does in that situation, and it's unambiguous.