You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
They're very useful in things like composer.json files, where there can sometimes be important things to document.
There's no reason that decoders can't allow and ignore them. Since some do just that, I think it makes sense for JSON linters to provide a flag that will let them pass through as well. The user will know best what their particular use case allows.
The text was updated successfully, but these errors were encountered:
Even allowing comments behind a flag won't allow you to put JS comments in the composer.json. For performance reasons, Composer uses PHP's json_decode to read JSON files. It uses this library only to provide a better error message in case of failure.
I'm not sure how closely you want to track
zaach/jsonlint
, but they have an open issue for this as well.Comments aren't technically valid, but I wouldn't say they're invalid either.
Douglas Crockford (creator of JSON) has said:
Comments were initially allowed in JSON, and were only removed to prevent people from adding parsing directives.
They're very useful in things like
composer.json
files, where there can sometimes be important things to document.There's no reason that decoders can't allow and ignore them. Since some do just that, I think it makes sense for JSON linters to provide a flag that will let them pass through as well. The user will know best what their particular use case allows.
The text was updated successfully, but these errors were encountered: