Hacker News new | ask | show | jobs
by simonw 1775 days ago
Which ones do that? I've not encountered many myself.
3 comments

* C# - builtin via JsonCommentHandling, JsonSerializerOptions.AllowTrailingCommas - Newtonsoft via CommentHandling, trailing out of the box

* C++ - Boost.JSON/RapidJSON/DAW JSONLink have options for both, nlohmann has an option to allow comments

* Python, I only know doing it via jsmin first

* Javascript, use jsmin also

These are the ones I have used or seen. It comes up so often that parser writers get issues over and over until they support them. nlohmann did not for years. But people want them for config files and such. Them being an extension is nice in that they are not officially supported and how they are handled isn't specified.

What a delightfully readable example of a hand-rolled lexer and parser that is.
I thought you were being sarcastic, but I think I just finally learned how lexers and parsers work by reading the code, and I don't even know Go.
Hah yeah no sarcasm intended at all! It's really neat code.
Ruby's supports comments. But that's the only one I know of