Skip to content

Instantly share code, notes, and snippets.

@MoOx
Last active August 27, 2026 07:02
Show Gist options
  • Select an option

  • Save MoOx/5271067 to your computer and use it in GitHub Desktop.

Select an option

Save MoOx/5271067 to your computer and use it in GitHub Desktop.
How to make comment in JSON file
{
"//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"
}
@raghavtib43

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment