On Sun, Dec 24, 2017 at 10:58 AM, Martin Nilsson (Coppermist) @ Pike (-) developers forum 10353@lyskom.lysator.liu.se wrote:
Having taken a quick cursory look at the new JSON5 module, I think it would make sense to have a distinct decoder for JSON5, but have common code for the encoder. Having decode() and validate() call the appropriate implementation depending on flags. This would reduce the amount of code duplication, and ensure that the flags used by the modules stay compatible.
I think it makes sense to have JSON and JSON5 exposed as different modules, since presumably you know which version of JSON you are processing. In JSON5 you can encode more compact than JSON, and there is support for inf/nan, so you want different encoder behaviour.
If they can share common code, it might be good to have them in one module, with encode_json5 and decode_json5. AIUI, if you're not sure which one you're decoding, you can decode as JSON5, as it's a strict superset of JSON.
ChrisA
pike-devel@lists.lysator.liu.se