Although traditional comments are not allowed in JSON, there is one work-around.
JSON is data-only, meaning something like this won’t work:
{
# note: this is out of stock
"title": "Red Addidas Shoes",
"price": 50
}
Instead, we can add a new data element to the JSON and just ignore it when we read the JSON into our code.
{
"_note": "this is out of stock"
"title": "Red Adidas Shoes",
"price": 50
}
If you want to learn more about why comments aren’t allowed in JSON, checkout this post.