Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

An often-heard benefit for using YAML is that JSON does not have comment. What I don't understand is why we would switch to a whole new language. Just add a filter before loading the configuration, which can't be harder than switching to YAML, right?

Another reason for YAML is that it is easier to read. That I don't understand either. The endless pain of dealing with configuration does seem come from saving a few seconds of parsing off braces and brackets, but from not being about easily figure out what goes wrong, especially when what's wrong is a missing space or tab embedded in hundreds of lines of configurations.



I like json a lot.

That said, I think json would benefit from only two things:

1) comments

2) allow extra commas, like ["a", "b", "c",] or {"a":"b", "c":"d", }

or more properly:

  {
    "a":"b",
    "c":"d",
  },
EDIT: and json5 does both, plus a few more niceties. (hmm. too much?)



Just make another named list key called "comment". Problem solved.


This is not always an option when JSON is propagated as is, nor does it allow for comments on specific object properties.


Not sure why people just don't settle with TOML.


It has atrocious arrays. Example: https://youtu.be/n9mGk8_tQtM?t=367




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

Search: