lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2017-06-15 17:42 GMT+02:00 Sean Conner <>:
> It was thus said that the Great Dirk Laurie once stated:
> > Is the Lua representation of JSON reasonably standard across decoders
> > by now? The one I use [1] translates integers to integers; floats to floats;
> > strings to strings; arrays and objects to tables, distinguished by
> > their metatables. There is one metatable for all JSON objects and
> > another for all JSON arrays. Those metatables are not functional,
> > they merely contain fields that identify to which JSON type the table
> > corresponds.
> >
> > Do other JSON decoders do this differently?
>   For Lua 5.3, my own JSON decoder [2] returns integers as integers, floats
> as floats and arrays and objects as tables sans a metatable.

That decodes JSON '[]' and JSON '{}' to inditinguishable Lua tables.
I presume you only decode, not encode too?