JSON configuration rather than YML
closed
G
Greg Bowler Circleci
I have had so many issues with configuration due to the unnecessary imposing and contradictive whitespace rules of YML.
For instance, having to indent with exactly two spaces, apart from when the section is a named list, in which case you use four spaces.
For someone who writes code in a language that uses braces to indicate their block level, which is the same case for the structure of JSON, using YML feels worse than writing XML by hand.
JSON is very popular and I can't see a reason as to not use it for configuration, at least as an option.
CCI-I-462
c
child.jason@icloud.com
YML is garbage. i have spent more time dealing with formatting issues breaking yml than having to deal with "json not having comments" in my course of my career.
N
Nathan Dintenfass
YAML is a superset of JSON, so in almost all cases you should be able to write JSON. As long as the data is shaped in the same way it will work. We don't recommend this, as in most cases it's harder to read and won't look like our documentation, but the underlying YAML parser will see your JSON string as YAML and pass it through correctly. If you see anomalies to this we'd be curious to hear about them.
For instance, I tried to run a build with this as the config, and it worked the same as if it were written in the YAML-ized format:
{ "version": 2, "jobs": { "build": { "docker": [ { "image": "circleci/ruby:2.5.1-node-browsers" } ], "steps": [ "checkout", "run": "echo thing" ] } }}
a
a m
Please, don't. Using JSON as a config file format is a very bad idea: JSON is a machine interchange format, and it's terrible as a config file format. Config files should be readable, have comments, and not being strict. JSON is nothing like that.
C
Chris Shaw
Agreed https://www.chris-shaw.com