Skip to content

Instantly share code, notes, and snippets.

@DamianEdwards
Last active June 5, 2024 19:50
Show Gist options
  • Save DamianEdwards/31d2457737304ca73556 to your computer and use it in GitHub Desktop.
Save DamianEdwards/31d2457737304ca73556 to your computer and use it in GitHub Desktop.
JSON comments on GH

What happens if you tell GitHub it's JSON

{
  "hello": "world" // I want my comments!
}

Just tell GitHub it's JavaScript

{
  "hello": "world" // I want my comments!
}
{
"hello": "world" // I want my comments!
}
@MistEO
Copy link

MistEO commented Jan 7, 2022

cool!

@dantebarba
Copy link

Would be great to have key-value syntax highlighting just for readability purposes.

@CryDeTaan
Copy link

CryDeTaan commented Oct 10, 2022

@dantebarba one way to cheat it seems to be yaml
https://stackoverflow.com/a/58946269

{
  "hello": "world" # I want my comments!
}

@dantebarba
Copy link

@CryDeTaan thanks!

@ElectricRCAircraftGuy
Copy link

ElectricRCAircraftGuy commented Jan 25, 2023

Thanks! I just wrote about this here, and referenced you: Stack Overflow: Can comments be used in JSON?

@whyboris
Copy link

whyboris commented Jun 2, 2023

Testing today:

```json

{
  "hello": "world" // comment
}

```jsonc

{
  "hello": "world" // comment
}

```json5

{
  "hello": "world" // comment
}

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