Submit Your Ideas

We want to hear from you - vote for the features and improvements you'd most like to see, or submit your own ideas if you don't find them already listed.

JSON configuration rather than YML

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.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Jun 14 2018
  • Already exists
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    14 Jun 08:23
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    14 Jun 11:18

    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.

  • Admin
    Nathan Dintenfass commented
    14 Jun 16:33

    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"
    ]
    }
    }
    }