Unmaintained Mirror ===============
Please go to the real repo at <https://git.coolaj86.com/coolaj86/json2yaml.js
json2yaml ===
A command-line utility to convert JSON to YAML (meaning a .json file to a .yml file)
The purpose of this utility is to pretty-print JSON in the human-readable YAML object notation (ignore the misnomer, YAML is not a Markup Language at all).
Installation ===
npm install -g json2yamlNote: To use npm and json2yaml you must have installed NodeJS.
Usage ---
Specify a file:
json2yaml ./example.json > ./example.yml
yaml2json ./example.yml | json2yaml > ./example.ymlOr pipe from stdin:
curl -s http://foobar3000.com/echo/echo.json | json2yaml
wget -qO- http://foobar3000.com/echo/echo.json | json2yamlOr require:
(function () {
"use strict";
var YAML = require('json2yaml')
, ymlText
;
ymlText = YAML.stringify({
"foo": "bar"
, "baz": "corge"
});
}());
Example
===
So, for all the times you want to turn JSON int YAML (YML):
{ "foo": "bar" , "baz": [ "qux" , "quxx" ] , "corge": null , "grault": 1 , "garply": true , "waldo": "false" , "fred": "undefined" }