Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding comments to a JSON file

Tags:

json

comments

Can you and what would be the best way to add comments to a JSON file?

I've used //comments and "_comment"

like image 693
VBM46 Avatar asked Feb 23 '26 19:02

VBM46


1 Answers

No, comments of the form //… or /*…*/ are not allowed in JSON. This answer is based on:

  • https://www.json.org
  • RFC 4627: The application/json Media Type for JavaScript Object Notation (JSON)
  • RFC 8259 The JavaScript Object Notation (JSON) Data Interchange Format (supercedes RFCs 4627, 7158, 7159)

Ref: https://stackoverflow.com/a/4183018/

like image 69
danny26b Avatar answered Feb 26 '26 10:02

danny26b



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!