The attached patch to 2.12 implements C style comment processing inside Json. This feature is enabled by the flag JSON_ALLOW_COMMENTS (for the json_load family functions). The flag is disabled by default.
It supports both // and /* ... */ comments. Comments can occur anywhere whitespace is permitted. Comments are not preserved, so a json_load followed by a json_dump will strip the comments.
I know the issue of comments in Json is controversial since it is not part of RFC 4627. Others will argue that comments that are not preserved are worthless.
First, there is virtually no performance impact if you do not enable JSON_ALLOW_COMMENTS. So what's the harm? Many Json libraries out there support comments. For Json files that are meant to be created and maintained by humans (such as configuration files), comments are essential.
As to RFC conformance, JSON_ENCODE_ANY violates RFC 4627 so there precedence.
The patch impacts jansson.h and load.c only.
If accepted, I would be happy to add a test suite and modify the documentation.