1. json-to-pretty-yaml
A node module to convert JSON to YAML
json-to-pretty-yaml
Package: json-to-pretty-yaml
Created by: alexcrist
Last modified: Sun, 19 Jun 2022 06:29:05 GMT
Version: 1.2.2
License: Apache-2.0
Downloads: 9,573,641
Repository: https://github.com/alexcrist/json-to-pretty-yaml

Install

npm install json-to-pretty-yaml
yarn add json-to-pretty-yaml

♻️ json-to-pretty-yaml

A node module to convert JSON to pretty YAML

Installation

npm install --save json-to-pretty-yaml

Usage

index.js

 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

 {
  "a": 1,
  "b": 2,
  "c": [
    {
      "d": "cool",
      "e": "new"
    },
    {
      "f": "free",
      "g": "soon"
    }
  ]
}

output.yaml

 a: 1
b: 2
c:
  - d: "cool"
    e: "new"
  - f: "free"
    g: "soon"

Testing

npm test

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin