Closed tianon closed 10 months ago
I believe JWCC is out of scope. This package is aiming to implement RFC 8259 for the JSON specification itself. Also, supporting JWCC may require changes to the API. The JSON grammar has the nice property that Encoder.WriteToken
can infer whether it needs to emit a comma or not since the grammar only allows for one valid representation. Once, you permit trailing commas, the encoder now needs to make a decision of whether to emit the trailing comma or not. People will differ about whether it should, which will probably require even more API.
If you want JWCC support, I recommend using github.com/tailscale/hujson. Note that I'm involved in both this project and also the author of the "hujson" package.
Closing as support for JWCC is out of scope.
See https://github.com/go-json-experiment/json/issues/11#issuecomment-1629791113 for an alternative.
Hi! :innocent:
I figured the group behind this has already probably had several discussions about JWCC (https://nigeltao.github.io/blog/2021/json-with-commas-comments.html), but I looked very hard for permutations of "JWCC", "json5", "hujson", "jsonc", etc etc etc and couldn't for the life of me find anything relevant either here or in issues on golang/go, so I figured maybe it's worth having an issue so it can either be formally considered or at least have the justification against written down somewhere that can be referenced later. :smile: :heart: