Pre-requisite :
- Python3
- Pip
pip3 install pyyaml
test.yaml
- configMap:
defaultMode: 420
name: grafana-dashboards
name: grafana-dashboards
convert to oneline with :
cat test.yaml | python3 -c 'import json, sys, yaml ; y = yaml.safe_load(sys.stdin.read()) ; print(json.dumps(y))'
[{"configMap": {"defaultMode": 420, "name": "grafana-dashboards"}, "name": "grafana-dashboards"}]