January 29, 2023

Blog @ Munaf Sheikh

Latest news from tech-feeds around the world.

Convert JSON to YAML – Mastering JS


Feb 15, 2022

Below is a converter that transforms JSON into YAML.

In Node.js

To convert JSON to YAML, you should install json-to-pretty-yaml.
Use the stringify function() from the npm module to convert the JSON.

const YAML = require('json-to-pretty-yaml');

const json = '{ "a": 1, "b": 2, "c": 3 }';

const data = YAML.stringify(json);

data;

More Tools



Source link