JSON is like the carcinization of programming
I love JSON. But I really wish there was a standard that allowed commas with no following items and that there was a syntax for comments.
That’s not JSON. Note the use of equal signs for the property names. That’s something else.
Equals schmequals.
It could be a⇨and it would be the same as JSON because it is still a single symbol used as a separator.a distinction without a difference
Now, if it took multiple separators, each giving some specific different meaning, then it would be a something else.
It could be a ⇨ and it would be the same as JSON because it is still a single symbol used as a separator.
Nah, that’s a Ruby Hash…
schmooby schmash
Carcinisation is the phenomenon of non crabs to evolve crab like characteristics. It is not the process of non crabs becoming true crabs.
In this case the language is trending toward JSON syntax, but it doesn’t have to actually be JSON for carcinisation to be an applicable analogy.
So, you can say, it’s something else? 🤔
Yeah, a joke, if you look up you’ll see it.
What’s it called when people try to reinvent Lisp for the hundredth time?
carthinazation
Chuck in comments and I’m on board.
Just make JSON5 the new official version and I would be ok
If we’re adding comments to json, can we add canonical support for trailing commas?
Found the python guy!
Oh, a trailing comma? That’s a tuple.

They were chucked out because, according to the guy who defined it, people started using them for parsing directives, which hurt interoperability because now you needed to be sure that the parser would both read the comments and interpret them correctly. Suddenly, those comments might make otherwise identical files parse differently. If the whole point is that it’s reliable and machine-readable, keeping it to the minimal set of features and not extending it any way whatsoever is a good way to ensure compatibility.
What you can do is define some property for comments. It’s not standardised, but you could do stuff like
{ "//": "This is a common marker for comments", "#": "I've never seen that as a property name, so it might be safe?", "_comment": "Property names with underscore for technical fields seem common enough as well, and it's semantically explicit about its purpose" }“_comment”
I appreciate the workaround here, and I’ve tried this in production environments to one degree or another. This usually fails due to another problem: the number of systems that think unexpected JSON keys are an error, is is too damn high.
And also, JSON was intended as a data serialisation format, and it’s not like computers actually get value from the comments, they’re just wasted space.
People went on to use JSON for human readable configuration files, and instantly wanted to add comments, rather than reconsider their choice because the truth is that JSON isn’t a good configuration format.
JSON was intended as a data serialisation format
Why then use a inefficient text based format instead of a much more efficient and easy to parse binary format?
Just use DER encoded ASN.1 like a normal person.
I’m not a real programmer but I was wondering wtf you’re on about because I don’t think I’ve ever worked with a json file in a system that didn’t use // for comments lmfao
Python, for example
I did say “I’m not a real programmer” heh 😮💨 I just thought // was standard for comments across all json files
No biggie, I just named an example. Even “real” programmers, whatever definition you want to use for that, don’t know all languages.
But yes, many languages do use // as comments and particularly the Javascript environment it originally stems from does. Python (
#) and SQL (--) are the only examples I interact with frequently enough to know off the top of my head (but SQL still recognises/* ... */for delimited comments). XML/HTML also has<!-- -->for comments, but that’s not so much a programming and more of a description language.
I like this. I also like yaml, I’ve had very few issues with it and it’s nicer to work with than json.
Json’s lack of support for trailing commas and comments makes it very annoying for everyday use.
Just the other day I had a list show up as [“a”, “b”, “c”, “d”, “e”, false, “g”, “h”, “i”].
The issue was that, without me being overly aware of it, the data was going through a data -> yaml -> data step.
Yes, the data -> yaml filter was broken for not putting general strings in quotes. But IMO the yaml design invites these odd “rare” bugs.
I used to like yaml, but was happy to see Toml taking the niche of human-readable-JSON, but felt the format for nested key-value was a weird choice. However, I’ve always felt we could just have extended JSON a bit (allow line breaks, comments, if the outermost data type is an object, the curly brackets may be omitted).
Using YAML as an intermediate format between steps of a process is a mistake. I love YAML for configuration but I’d never use it for machine-to-machine anything. If the tool you’re feeding data to requires YAML as input, just give it JSON. All JSON is valid YAML.
Edit: I realize you weren’t the one who made that decision. I’m saying the problem isn’t YAML, the problem is someone using YAML inappropriately.
Significant white-space is bullshit and i will die on this hill.
Because I am not counting white space when I read. Or should we just write machine code/assembler/pick something straight away?
Not sure I’m following the jump from significant whitespace to machine code. How are those related?
Human and machine read differently. If you ignore that (in case with indentation), then why bother with writing human-friendly form of code, when what is going to be really executed is something else?
If anything, that sounds like an argument in favor of significant indentation, not against it. Humans and machines read differently, yes, which is why we tend to add whitespace and indentation to code even for programming languages where it’s not significant. We do that expressly because it makes the code more human-friendly, so it’s quite the opposite of ignoring their differences.
No, it is an argument against it. We indent code so that it is more comfortable to read it, not in order to make it easier to understand
Because yaml is not a programming language, and debugging why your whatever you’re configuring isn’t working correctly can be a nightmare. It doesn’t tell you you missed an indent on a block, it just assumes it should be there and changes the meaning.
Braces are visually clear.
You are not alone, my friend
Is there space left on the hill? I want to join you.
I hear there’s significant space left
But it’s only white space. That’s kinda racist.
significant white space to it’s classist and racist
Preach!
Is there any real reason why most progranming languages look more like the 3rd panel and not like the 1st panel? There’s gotta be a reason for all the nesting and indents that has nothing to do with readability since that shit makes it harder to read.
Once you’re used to it, indentation makes code soooooooo much easier to read. When I was in school and a classmate asked me for help with their code, I outright refused to touch it until they properly indented it. It makes it easy to see the structure.
For programming languages that make use of
{}, the reason is (almost always) scope.Take for instance this:
for i in 0..10 do_thing(); do_other_thing();compared to this:
for i in 0..10 { do_thing(); } do_other_thing();The intent of the first one is unclear. In the second one it’s clear you should loop
do_thing()and then rundo_other_thing()afterwards. The indentation is only for readability in the above though. Logically there would be no difference in writingfor i in 0..10 { do_thing(); } do_other_thing();Languages that use indentation and line breaks for scope look more similar to this:
for i in 0..10: do_thing() do_other_thing()Because the 3rd panel looks better when you have dozens of physical properties to track. It also makes retrieval easier because you can get all the physical properties at once, instead of having to read every line.
For an example that small it doesn’t matter, but for something larger it could become a performance benefit.
I would guess that it has to do with making it easier to parse. The indents won’t matter very much, but the parser sees "physical = " and knows that a property named physical is being defined. What is the value of that property? Well, there’s a “{”, so the value is an object. And the value of that object is everything up until the matching “}”. If you have a structure more like panel 1, then it’s harder for the parser to know when the value of orange.physical is complete. There might be a [orange.physical.texture] section somewhere, for example.
since that shit makes it harder to read
It makes it harder to read the individual lines, but makes it easier to read them as a group, so you won’t have to read as many lines on your day to day.
A good way to feel that for yourself is by programming a little program in Assembly and C.
Make sure the program needs to loop a bit and perhaps also require some
if/elselogic.
A simple one would be to read a 1000 integers and return the sum.In C, you would do something like:
int MAX = 1000; int accumulator = 0; int counter = 0; while (counter < MAX) { accumulator = accumulator + value_at_next_memory_location_by_counter; counter = counter + 1; }In assembly, you would go (writing pseudo, because I have forgotten most assembly stuff):
set reg1 = 1000 // For max value set accumulator = 0 // just choose a register and consider it an accumulator. older CPUs have a fixed accumulator and you can only operate on that. I am not considering that here set reg2 = 0 // For counter tag LOOP: set flag if true reg2 < reg1 jump if false -> END move from memory location @counter(reg2) to reg3 add accumulator reg3 add reg2 1 goto -> LOOP tag END:
I also realised that you could just try using C with
gotoinstead of any loops and would realise similar things, but I’m not in the mood to rewrite my comment.
In conclusion, it is easier to understand something like BASIC, if you haven’t been introduced to other languages, but these
{}structures end up making it easier to catch control flows at a glance.
That’s also the argument I use when telling people to have opening and closing brackets of the same level at the same indent, while people prefer stuff like:if { ... } else { ... }
Time to read this if you haven’t already
https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell
Almost all of those issues are solved by explicitly quoting your strings, the author even acknowledges that. Yeah it’s annoying that yaml lets you do otherwise, but the title is a bit dramatic.
As someone who likes lua, I don’t see the problem.
orange = { you = "glad", I = { didn\'t = { say = "banana" } } }I will die on the hill that XML is a superior config format and people are just afraid of it cause they see the advanced features (that you don’t need to use) and think it’s too complicated.
If yaml didn’t have anchors and 8 different white space formats, it’d be a great replacement for this kind of thing.
But yaml is a mess, and you’d think you could parse it easily, but you can’t.
YAML is redeemed by one thing only:
All JSON is valid YAML.
No way. You’re telling me I can just write json instead?
Yup! YAML is defined as a “strict superset” of JSON (or at least, it was the last time I checked).
It’s a lot like markdown and HTML; when you want to write something deeply structured and somewhat complex you can always drop back/down to the format with explicit closing delimiters and it just works™.
I found out the hard way this is not entirely correct, as a user found a valid json that yaml parsers didn’t handle. IIRC it was some exotic whitespace issue
Yes, in true YAML fashion, there are some edge cases where things act weird but are technically correct.
I have a fundamental disdain for formats with restrictive white space definitions (I’m looking too at you Python)
I’ve never had this issue with Python, but makefile has given me plenty of whitespace issues.
Should have added if it cares about tabs vs spaces.
As someone who works with YAML regularly:
Fuck YAML.
As someone who runs Home Assistant:
Fuck YAML.Nah, yaml isn’t great by virtue of itself but with what it competes with. I far, far prefer it to any other BS. Json is garbage for human creation and obviously toml due to above. XML… Obviously just for machines.
Again, only good because of its competition.
I prefer writing JSON by hand. The whitespace stuff in YAML is just such a nuisance as far as I’m concerned, which is odd as I have no problem with it in Python.
I want to like yaml, I really do, but why are there so many different ways of specifying the same thing?
Is there a reason? Norway!

















