JSON TO PRETTY YAML

JSON

Paste your JSON here

YAML

See the YAML output here

Bash

npm install -g prettyaml
# From file
prettyaml example.json

# From stdin
cat example.json | prettyaml

JavaScript (Node.js)

(function () {
  "use strict";
  
  var YAML = require('prettyaml')
    , json
    , data
    , yml
    ;
    
  json = '{ "foo": "bar" }';
  data = JSON.parse(json);
  yml = prettyaml.stringify(data);
  
  console.log(yml);
}());

JavaScript (browser)

<script src="http://fiatjaf.github.io/prettyaml/js/prettyaml.js"></script>
(function () {
  "use strict";
  
  var YAML = window.YAML
    , json
    , data
    , yml
    ;
    
  json = '{ "foo": "bar" }';
  data = JSON.parse(json);
  yml = prettyaml.stringify(data);
  
  console.log(yml);
}());

Python

import json
import pyaml

str = '{ "foo": "bar" }'
data = json.loads(str)
yml = pyaml.dump(data)

print(yml)