lua-users home
lua-l archive

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


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.

  -spc

> [1] rapidjson

[2]	https://github.com/spc476/LPeg-Parsers/blob/master/json.lua