commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Valid JSON is a subset of YAML; no transformation is necessary; however, YAML has many syntax features that are not valid JSON, so you can't do the reverse as easily.
There are 4 alternatives - vote for the best!
Convert JSON to YAML.
Note that you'll need to have PyYaml installed.
You need to install the Catmandu Perl module via `cpanm Catmandu`
This is based on __unixmonkey73469__ answer. You will need to supply `--multiline 1` option to JSON importer if your .json is multiline (i.e. it was prettyfied)
And you still need catmandu installed via `cpanm Catmandu`
since Mozai said that JSON is a subset of YAML ;)
If you can do better, submit your command here.
You must be signed in to comment.