fancy-json-stringify

A fancy way to convert a JavaScript value to JSON

Usage no npm install needed!

<script type="module">
  import fancyJsonStringify from 'https://cdn.skypack.dev/fancy-json-stringify';
</script>

README

fancy-json-stringify workflow npm

A fancy way to convert a JavaScript value to JSON

This module is a wrapper around JSON.strigify with an EOL. Defaults to no replacer and white space identation of 2.

Installation

npm install fancy-json-stringify

Usage

const fancyJsonStringify = require('fancy-json-stringify')

fancyJsonStringify({hello:'world'})

Above results with appropriate EOL, which is why it's fancy :P

{
  "hello": "world"
}

API

fancyJsonStringify(value, replacer, space)

value

A JavaScript value to be converted.

replacer

A function that transforms the results. Defaults to null.

space

Adds indentation, white space, and line breaks to the return-value. Defaults to 2.

License

MIT (c) Cezar Augusto.