Using JSON instead of YAML for configuration

I am pretty new to hass, but I am already fed up with the YAML configuration :grinning:.

Thanks to node.js, I found a way to use JSON instead on my ubuntu based server.

  1. Install node.js:
    sudo apt install nodejs
  2. Install the package yamljs:
    sudo npm install -g yamljs
  3. Convert your existing configuration.yaml:
    yaml2json .homeassistant/configuration.yaml -p > .homeassistant/configuration.json
  4. Edit .homeassistant/configuration.json as you like
  5. Convert it back to yaml
    json2yaml .homeassistant/configuration.json > .homeassistant/configuration.yaml
  6. Restart hass

In addition, I you have hass running as a service, you can automate step 5 by adding this line to etc/systemd/system/home-assistant@[user].service:
ExecStartPre=/bin/sh -c "/usr/bin/json2yaml ~/.homeassistant/configuration.json > ~/.homeassistant/configuration.yaml"

Whenever you restart with sudo systemctl restart home-assistant@[user], the existing yaml will be overwritten with the converted json before starting hass

Couldn’t you just use PyYaml instead of installing node?

Or use appdaemon instead of writing automations in yaml.