rutrum ,
@rutrum@lm.paradisus.day avatar

Just gonna throw out HJSON as another alternative: https://hjson.github.io/

I thinks a great idea but I have never seen it used in the wild, unforunately.

NewPerspective ,

TOML and YAML both have the problem that if you receive an incomplete document, there's a decent chance you can't tell. JSON doesn't have that because of the closing curly.

AMDmi3 ,

That's not a problem of a format and should be handled by transport or storage.

brettvitaz ,

Every time I have reached for TOML I have ended up using JSON. The first reason is that Python standard library can read but not write TOML, which is generally useless for me. The second reason is TOML does not add any benefit over JSON. It’s not that much easier to read and IMO JSON is easier to write by hand because the syntax rules are completely obvious.

eager_eagle ,
@eager_eagle@lemmy.world avatar

TOML is mainly for humans to write, certainly not a good choice if you're programmatically writing files - comments and formatting would be lost.

brettvitaz ,

Agreed. Except that it’s not easier to write imo

spartanatreyu ,
@spartanatreyu@programming.dev avatar

Where do you put your comments in JSON files?

Quetzalcutlass ,

I've seen them included as part of the data.

"//": "Comment goes here",

Example here.

suy ,

The very first moment that I had to use JSON as a configuration format, and I was desperate to find a way to make a long string into a JSON field. JSON is great for many things, but it's not good at all for a configuration format where you need users to make it pretty, and need features like comments or multi-line strings (because you don't want to fix a merge conflict in a 400 character-wide line).

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • programming@programming.dev
  • test
  • worldmews
  • mews
  • All magazines