Open mythay opened 9 years ago
:+1:
I think this would be better handled by a metatable to specify whether an object or table is needed. That would allow more consistent use of types.
Please see https://github.com/mpx/lua-cjson/issues/11
...I agree with @mpx that this needs to be done on a per-value basis rather than a per-encode operation since you may want to mix an empty JSON object with an empty JSON array.
there are three possiable values for the parameter, dict/array/null If a table is empty, we can control the encoding result to an empty dictionary or empty array of null in json format