Hacking Comments Into JSON
Notes
| 2025-09-19
(updated 2025-10-25)
| 1 min read
#json
JSON does not natively support comments, which is OK, but sometimes a comment could really help.
If the application loading the JSON does not care about additional keys
we can simply add a key with our favorite comment indicator like // or #.
{
"//": "This setting enables not just A, but somehow also B",
"enable_feature_a": true
}
While this works consider using a different file format better suited for configuration.