UNPKG

@cowprotocol/cow-sdk

Version:

<p align="center"> <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" /> </p>

56 lines (42 loc) 652 B
# ♻️ json-to-pretty-yaml > A node module to convert JSON to pretty YAML ## Installation `npm install --save json-to-pretty-yaml` ## Usage #### `index.js` ```javascript const fs = require('fs'); const YAML = require('json-to-pretty-yaml'); const json = require('input.json'); const data = YAML.stringify(json); fs.writeFile('output.yaml', data); ``` #### `input.json` ```json { "a": 1, "b": 2, "c": [ { "d": "cool", "e": "new" }, { "f": "free", "g": "soon" } ] } ``` #### `output.yaml` ```yaml a: 1 b: 2 c: - d: "cool" e: "new" - f: "free" g: "soon" ``` ## Testing `npm test`