4 ms·
Ok, I'll bite. { "#": "A foo variable", "foo": true, "#": "A bar variable", "bar": false } Alternatively. { "# A foo variable": ""
by mottosso 8y ago
Ok, I'll bite.
{
"#": "A foo variable",
"foo": true,
"#": "A bar variable",
"bar": false
}
Alternatively.
{
"# A foo variable": "",
"foo": true,
"# A multiline..": "",
"# .. bar variable": "",
"bar": false
}
Presto!
- chx 8y agoSigh. All I wanted to do is to say thanks for the YAML standard -- comments are important but not the only problem with JSON. And truly I can't be expected to remember all of this discussion from like six plus years ago. One thing I remember though, it the trailing comma problem -- we upstreamed a grammar change to Doctrine annotation so "foo, bar," is OK because PHP arrays accept that and it's bonkers trying to code a mostly PHP system without trailing comma support. Also, JSON is no fun to write , you need to have [] {} all correct where YAML is much easier. The less sigils the better and most of Drupal YAMLs only use the dash, the colon and the quote. This is the grave mistake Doctrine committed as well, instead of simple arithmetic (>=1.0) they used mysterious sigils in version specification (~1.0). Drupal is in the business of constantly accepting new contributors and (~R∊R∘.×R)/R←1↓ιR is not newbie friendly, no matter how you slice and dice it. There are certainly advantages of sigil heavy languages like APL and Perl but the scare factor is too high.
- jiveturkey 8y agofair enough, but then you probably shouldn't have led off your earlier comment with "that simple".
- goatlover 8y agoThat's just ugly and you're mixing your comments with the data structure, which is potentially confusing. Also, Jason requires a lot more typing. I don't want to have to manually add in all the brackets, quotes and commas when editing config a file.
- deleted 8y ago[deleted]
- mypalmike 8y agoPresto! You have a duplicate key in the first example. Also... print (json.dumps(json.loads(js_data), indent=2)) { "bar": false, "foo": true, "# A multiline..": "", "# .. bar variable": "", "# A foo variable": "" } Presto! ;-)