Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
I wish JSON5 was more popular (evertpot.com)
3 points by treve on Jan 9, 2023 | hide | past | favorite | 3 comments


> I couldn’t tell you why uses has a dash in front, and node-version does not.

Yes you could. I agree that YAML is hard to parse, but a moment's reflection reveals that "steps" is an array of things, and "node-version" is a property of "with", which is a property of the second element of "steps" (along with "uses").

The thing that has tripped me up about YAML the most is the question of when I have to indent, and by how much.

Generating configuration for a system is a pain in the ass and carries all the ills of a build system, but a loud comment saying "this is generated from X!" and a Makefile do well enough most of the time.

Some ideas for configuration formats:

- .js file that evaluates to a JSON-compatible value

- [EDN][1] and other s-expressions

- a file system tree

There are two extremes. On the "no code" side there are gigantic reams of JSON/XML/YAML whose overall structure is all but impossible to understand. On the "all code" side there is a bespoke program that concisely produces the configuration but that can't be understood without already knowing the output.

I aim for the middle.

[1]: https://github.com/edn-format/edn


JSON5 makers apparently didn’t even know about prototype pollution until this week.


Use CUE and then generate your JSON/Yaml/etc




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

Search: