5 ms·
It's a lot easier for end-users to read and write by hand. If that is not a requirement, a simpler machine-friendly format is likely better.
by mixmastamyk 8y ago
It's a lot easier for end-users to read and write by hand. If that is not a requirement, a simpler machine-friendly format is likely better.
- amanzi 8y agoWriting YAML is not easy for end-users. The indentation--especially in large files--is really difficult to keep track of, and some really basic stuff like when to quote strings is not consistent at all.
- mixmastamyk 8y agoNope, indentation is not a problem with indentation guides. A misplaced comma in a JSON file however kills it, gets me every time I have to write it by hand. Also, it is true YAML has too many features, though I find they are typically ignored or disabled.
- krapp 8y agoA misplaced comma is also not a problem in an editor with syntax highlighting, but between the two, indentation could take longer to fix.
- mixmastamyk 8y agoSyntax highlighting doesn't count commas. The problem is JSON doesn't allow trailing commas, so adding or reordering frequently results in a difficult to diagnose error.
- krapp 8y agoFinding out if a set ends in a comma or not still makes it easier to debug than YAML.
- mixmastamyk 8y agoNot my experience, 10x more trouble with long JSON.
- shirakawasuna 8y agoIt definitely is. You have no idea how intimidating an equivalent JSON file would be for a new user creating a pretty simple k8s setup. YAML hides most of the scary brackets and quotes so that new users can focus on copy-and-pasting semantic tidbits. That said... I don't like YAML...
- krapp 8y agoBut the simpler format of JSON should be easier to write and read.
- mixmastamyk 8y agoSee sibling comment.
- deathanatos 8y agoNo comments, constant need to quote every string, inane comma requirements, no multiline string, little typing support.
- krapp 8y agoMany language require strings to be quoted, and calling the comma requirements inane is an opinion, not an objective fact. You're not saying anything about the readability of one versus another, you're just listing gripes you have about JSON.
- deathanatos 8y ago> Many language require strings to be quoted The languages we're comparing here are JSON and YAML. The latter does not require quoted strings, except in ambiguous cases. (And even then, actually, it technically isn't required, though it is usually the easiest thing to do.) The absence of these quotes makes the syntax get out of the way of the reader, and makes YAML comparatively easier to read. > comma requirements inane is an opinion, not an objective fact. I boiled it down to a simple statement, but disallowing a comma at the end of repeated grammars means that adding something to that line causes unnecessary noise in the diff. For example, say I add a single item to the end of a JSON list. The diff I would love to see is: [ a, b, + c, ] which makes it rather straight-forward to the code reviewer / reader of the diff that we're simply adding a single item c. But JSON's grammar forces this diff: [ a, - b + b, + c, ] which makes it harder to see what the semantic change is, because simple syntactic changes are now clouding the picture. Also, I find that people's mental model of the task ("add item to end of list") causes them to forget that they need to add a comma to the item above it, resulting in syntax errors down the road. (Better diff tooling can help here, but often I find we have to work with the most primitive of tooling; if the grammar can lend itself towards such simple tooling, s.t. that tooling is more effective despite its simplicity, why not? And here, we can: grammatically, whether the list ends or does not end in a comma is rather meaningless, and JSON (and for a long time, JS) were pretty alone in this opinion. Most other languages allow that trailing comma. The only other one I can think of is SQL.) > You're not saying anything about the readability of one versus another, you're just listing gripes you have about JSON. The gripes I have about JSON don't apply to YAML. Hence, that's why I prefer using YAML, which was the original question.