I am confused, are they rich aristocrats looking down on me, because they are better than me, or am I looking up to them in disgust, because I am a peasant about to overthrow the system?
Why does a data transfer syntax need comments? It was never intended for writing config files like people use it all the time now (99% of which would do fine with a plain old .ini).
Not that JSON is particularly optimal for data transfer either. Using plaintext formats when neither the recipient nor the sender are humans is just a waste of memory/bandwidth and serializing/deserializing time.
Mainly for config files I want comments. Like, it’s not my fault node and angular use json for config, but they do. And there’s definitely times I’ve needed to add comments
I mean my point is that config files are a stupid use of those formats. As long as we're wishing for something different than the systems we're stuck with, may as well wish they chose to use a better system entirely than just a bodge of the poor choice they made.
Like I said, the vast majority of config files I've seen would work perfectly fine as a plain old .ini which incurs far less processing time to generate or parse and wastes far less space on syntax while still being perfectly human readable.
There are plenty of binary data formats to choose from for computer-to-computer data transfer. If the recipient knows the shape of the incoming data, all you need is to designate a field separator and control byte escape or stuffing sequence.
💯It's hard to explain, but something about having the brace at the beginning or end of a block that I can click on and have my IDE highlight the other destroys any argument to me that whitespace-based blocks are "more readable"
On the contrary, professionals should have strong reasoning for why they choose the formats they are using in the software they write. Too many software design choices are made carelessly because "that's the library I know" or "that's what we've always used" without thinking of the specifics of the application and their impact on the end user.
I personally think there is little to no reason to ever use plaintext formats for complex data structure serialization, and many applications like config files can get along perfectly fine with something far simpler like a good old fashioned .ini file which is easier to parse, so I rarely if ever see myself reaching for either JSON or YAML.
I assume they mean that when you make a typo in a JSON it will throw an error. There are dozens of typos that you can make when editing yaml that will produce syntactically valid documents that will instead just silently break functionality in an impossible to debug manner
The point is a removed space in yaml usually doesn’t make it an invalid yaml file but a missing functional character in json will fail to parse in the first place.
If you actually read some of the comments you reply to maybe you'd understand the problem...
The point is your want the parser to reject the file when you make mistakes. Accidentally removing spaces from yaml just gets accepted and your keys, now at the wrong level will usually be ignored leaving you ignorant as to what went wrong...
Every time you edit a random YAML file you always have the schema available to your IDE so that it can do live validation? And then you're 100% sure that every system that ends up reading that file will validate it and error out on that unexpected key in a predictable and easy to understand way?
The point is that it's better to have that also enforced inherently by the syntax so there are fewer opportunities for the holes in the swiss cheese to line up and/or you're able to catch issues before they make it to CI or god forbid a prod server.
Have configuration files be whitespace dependent? No way in hell, I've already been bitten more than once by YAML in k8s due to this. JSON with all its {} is the superior choice as it clearly delimites stuff.
standard sql has no native support for parsing or querying yaml. and since i’m currently having to fuck around with that at work i absolutely abhor yaml.
I much prefer yaml in my project, because it's more compact and concise, especially in the way it handles collections, so small arrays of simple values can become [0, 1, 2] or [[0, 1], [2, 3], while bigger collections may be written as each item on it's own line. It allows for clear distinction between typed values and strings (I use quantities like 40ms, 300%, 30s, 2kg etc, and this also helps to distinguish enum values from strings), it has references that are very useful for serialization if utilized properly, it has tags that help with extending capabilities (I added !include <filename> for nesting one file into another, !template for discarding some values and using them only as a template for actual values, and !<typename> to define the instance type when the expected value is a base class).
I think you're being downvoted because JSON comments are non-standard. Non-standard is bad. Which parser you're using shouldn't even matter, but it does if you start considering non-standard comments. It's introducing other problems just to fix a dumb shortcoming of a standard that somehow got shoehorned into tons of applications it's not even that well suited for.
I previously used ARM templates (JSON) to manage Analytical rules in Microsoft Sentinel. It was always a pain as JSON does not support multiline strings so you have to escape every query. Not only is this an extra action but reviewing a PR with many changes is such a chore. Luckily with Bicep it is more akin to YAML and does support multiline strings.
Also I have used Anchors for a Helm chart YAML file so I only have to setup a value once and can use it multiple times.
so I only have to setup a value once and can use it multiple times.
Even better is that you may setup a shared template value once and use it multiple times changing only relevant properties, which for each use might be a different set. In my game I have it like that. A template for a part with all common values, a bunch more on top of that for parts of different sizes, and then each part only defines or redefines what it needs.
JSON > toml > yaml > CSV > pickle > writing down the data on a post-it note and retyping it each time > scrapping the data and having ChatGPT hallucinate a new set each time > setting the server on fire > xml
206
u/CarolXZosiaNsfwScene 1d ago
I am confused, are they rich aristocrats looking down on me, because they are better than me, or am I looking up to them in disgust, because I am a peasant about to overthrow the system?
Who is superior to who here?
275
u/RosieQParker 1d ago
If your syntax includes whitespace, fuck respectfully off.
24
u/DueButton7420 1d ago
XML looking at everyone from Hell...
38
u/Front_Committee4993 1d ago
"is it to much to ask for both" paradox when developing Victoria 3
56
u/xgabipandax 1d ago
CSV:
17
u/avast_ye_scoundrels 1d ago
Advisory: No professional has any opinion about the thesis of this developing nerd war.
8
u/threewholefish 1d ago
So "true"
13
u/MariusDelacriox 1d ago
XSD:
23
u/metaglot 1d ago
Yaml is not resilient against typos. Json is.
4
u/Suterusu_San 1d ago
Rust has me converted to toml
7
u/aweraw 1d ago
YAML is a superset of JSON since v1.2.
All valid JSON documents are also valid YAML documents.
3
u/Spikerazorshards 1d ago
Let’s just go back to INI files.
3
u/Specialist_Dust2089 1d ago
As a json fan, I have no comments
3
u/ForgedIronMadeIt 1d ago
meanwhile XML is the lich living in the dungeon under the palace
4
u/Elbinooo 1d ago
I hate both
6
u/nithix8 1d ago
guys i’m sorry but who’s this Jason?
2
u/Keyan_Farlander7 1d ago
TL;DR: One is data, the other is config.
2
u/Izikiel23 1d ago
Have configuration files be whitespace dependent? No way in hell, I've already been bitten more than once by YAML in k8s due to this.
JSON with all its {} is the superior choice as it clearly delimites stuff.
3
u/Dangerous_With_Rocks 1d ago
standard sql has no native support for parsing or querying yaml. and since i’m currently having to fuck around with that at work i absolutely abhor yaml.
7
u/aberroco 1d ago
I much prefer yaml in my project, because it's more compact and concise, especially in the way it handles collections, so small arrays of simple values can become
[0, 1, 2]or[[0, 1], [2, 3], while bigger collections may be written as each item on it's own line. It allows for clear distinction between typed values and strings (I use quantities like40ms,300%,30s,2kgetc, and this also helps to distinguish enum values from strings), it has references that are very useful for serialization if utilized properly, it has tags that help with extending capabilities (I added!include <filename>for nesting one file into another,!templatefor discarding some values and using them only as a template for actual values, and!<typename>to define the instance type when the expected value is a base class).So, no, for me the original post was correct.
3
u/andymurd 1d ago
The only format worse than YAML is TOML.
2
u/mcellus1 1d ago
Can look but can't comment 🤫
2
u/GreenWoodDragon 1d ago
I like YAML. It's less messy than JSON, more compact and much more readable.
1
u/NewGuySham 1d ago
I see what you did there
1
u/0bsidianM1nd 1d ago
If you are so great, why can't you parse this.
{"configuration": { Json looking at yaml: "enabled": true, "version": 2.0.1, "settings": [undefined, NaN, <invalid>] }}
1
u/bogoris76 1d ago
Oh boy, both are shit
1
u/0ttr 1d ago
Overthrow them, they can have my YAML when they pry it from my unemployed hands
1
u/Xlxlredditor 1d ago
Isn't yaml a superset of json technically
1
u/Random_182f2565 1d ago
Jason and Yamal
1
u/greyfade 1d ago
The problem with JSON, though, is JavaScript
1
u/Enough-Scientist1904 1d ago
Lmao looks like the json boys got deeply hurt by the previous meme
1
u/FFevo 1d ago
JSON for data. YAML for workflow definitions.
If you think they are competing solutions, you are wrong.
1
u/ryaaan89 1d ago
I love json but at least yaml lets you temporarily comment out a line.
1
u/wurnthebitch 1d ago
No comment
1
u/86BillionFireflies 1d ago
Compact binary formats looking at text based formats.
1
u/notatechproblem 1d ago
Understand that there are older and fouler things than YAML in the deep places of the internet...
https://www.ietf.org/archive/id/draft-rsalz-jsonx-00.html
1
u/__sean_eng__ 1d ago
Protobuff on the sidelines
1
u/TyrannusX64 1d ago
I still don't understand why docker k8s chose yaml over json. Json is way easier to read IMO
1
u/arcticslush 1d ago
Pkl: "I can't even see you guys from up here"
1
u/Excellent_Tubleweed 22h ago
xml notes that schema are a thing, peasants
1
u/Character-Education3 22h ago
1
u/kurotenshi15 3h ago
As a DevOps engineer first, YAML for life.
1
u/Wentyliasz 1d ago
JSON > toml > yaml > CSV > pickle > writing down the data on a post-it note and retyping it each time > scrapping the data and having ChatGPT hallucinate a new set each time > setting the server on fire > xml
1
u/MIGULAI 1d ago
Binary data at that time
0
u/Curious_Associate904 1d ago
Meanwhile hocon
0
u/[deleted] 1d ago
Nah. XML
-1
u/nithix8 1d ago
guys i’m sorry but who’s this Jason?
-4
u/KitaVixen 1d ago
JSON with its all " everywhere and problems if there is comma at end of something. YAML is better but still not perfect
0
u/[deleted] 1d ago
[deleted] — view deleted comment