HN2new | past | comments | ask | show | jobs | submitlogin

If it is "just JavaScript", why the lack of comments ?


Comments were intentionally excluded to prevent the use of parsing directives.

(Sadly, Crockford's post about this reasoning was on Google Plus and is no longer online.)


{comment : "your comments here!"}

{copyright comment : "JSON doesn't require/enforce specific comments is a good thing" }

{comments : "JSON parser is not an 'comment' editor! }

Don't know whtat the google plus article covered, but Crockfor's comments : https://www.linkedin.com/posts/douglas-crockford-724600109_j...


I think the spirit is forbidding creative developers from using the comments to include active content. I know people who if struggling with datetime encoding, would add a "// DATEFMT: YYYY-D-M" comment and be on their merry way, making it incompatible with all other JSON parsers.


What might be nice is to add a prefix to key name that indicates 'this is a 'internal document reference', skip this unless quests to parser to not ignore. Would allow for describing encoding method(s) used. date format comments being very helpful. Technically, can do by just dropping by key name.

Why comment on a format vs. adding an associated "key""format" with format information. aka date : 25.02.04 date-fmt : YY.DD.MM




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: