I’d like to make a case for supporting netlify.json as alternative to netlify.toml, in addition to the thoughts shared in Netlify.toml vs netlify.yaml - #7 by atishay and Allow Netlify config in JSON or YAML instead of only TOML - #3 by FunctionDJ.
- JSON is universal. Anyone doing web development already needs to know it. Compared to JSON, TOML is fairly obscure. I’m not sure I’ve used it aside from netlify.toml.
- JSON is intuitive and unambiguous. I admit there’s some subjectivity here, but considering my first point, far fewer people are going to be confused by JSON than TOML, especially when it comes to arrays and deep nesting.
- The biggest argument for using YAML, TOML, or anything else over JSON – lack of comments – is easily overcome by using a JSONC parser on the netlify side. You could also support the .jsonc extension in addition to .json, and that would give an easy way to support syntax highlighting for comments without additional editor configuration.
- You can provide a great out-of-the-box editing experience for json by defining a schema for it. As a rough demonstration, I converted the example netlify.toml file from the documentation to json, then dumped it into a schema generator, and added a couple of descriptions from the documentation. Here’s what it looks like to edit a json file using that schema in VS Code:
The ability to provide inline documentation and validation of the file would be huge - it would save a ton of developers a ton of time, and probably a lot of support time for you guys as well.
For me, working with netlify.toml is one of the biggest pain points of using netlify, and I think being able to use a JSON file with a well-defined schema would completely turn that experience around.