-
-
Save MoOx/5271067 to your computer and use it in GitHub Desktop.
| { | |
| "//field": "These 'double quote' 'double quote' are used as comments, because JSON doesnt' allow comment", | |
| "field": {}, | |
| "#another-field": "Another comment", | |
| "another-field": {}, | |
| "/*stuff": "Be careful to use them when you have full control of the content :)", | |
| "stuff": [], | |
| "bla": "bla" | |
| } |
You can create a special key in your JSON Mapquest Directions object to store comments. This key would be ignored by any JSON parsers that don't use it, but it allows you to include notes.
This is a trick I've seen somewhere in popular code Mapquest directions but can't remember where, sorry.
You can add a dedicated key to your JSON Safe Pest Sol object for storing comments—JSON parsers that don’t recognize it will simply ignore it, allowing you to include notes without affecting functionality.
JSON does not officially support comments, which means you cannot use standard comment syntax such as // or /* */ in a valid JSON file. If you need to add notes or explanations, a common approach is to include a special property such as "_comment" or "description" within the JSON object kryds og tværs. This keeps the file valid while allowing you to document what a particular section or value is used for. For projects that require actual comments, formats such as JSONC or YAML may be more suitable.
Hjson, at https://hjson.github.io/, works better for me than JSON5. YMMV.
Its Python module has been maintained more recently and its documentation shows the syntax of multiline comments as well as
#-based comments.