JSON.stringify is part of the standard JS spec: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
JSON5.parse() is part of JSON5's API: https://json5.org/#json5parse
So any project that includes both standard JS and JSON5 could literally copy and paste this code. You're still importing JSON5, but you would presumably have to do that anyways to use JSON5.
is not a convincing reply to
> so parsers already exist in every language
You'd have to rewrite anything using json_encode() and json_decode() in PHP, or the equivalent standard functions/methods in Python, C#, etc. And also take on another dependency. And maybe lose performance.
And then you sometimes may have to know whether you're dealing with JSON or JSON5, and what the program on the other end of the line produces or expects and can handle.
For new greenfield projects it might be worthwhile. But most of the world runs on legacy code and many prefer to stick to the standards and minimize dependencies. So it's not that simple.
That doesn't mean it's bad though. Like anything else in software, it's a trade-off.
Did you paste the correct link? This just plumbs together an existing JSON 5 parser with a JSON 4 serializer.
How many lines does this take without importing a library the solves this for you?