A json string formatter with zero dependency.
npm install json-string-formatternpm install --save json-string-formatter
yarn add json-string-formatter
javascript
const { format } = require('json-string-formatter';
// or
const jsonFormatter = require('json-string-formatter');
jsonFormatter.format(...)
`
2. Basic usage
`javascript
let input = "{'text': 'hello world!'}";
let output = format(input);
/**
* output = {
* /
`
3. Customized indent and linebreak
`javascript
let input = "{'text': 'hello world!'}";
let output = format(input, / indent / '--', / linebreak / '|');
/**
* output = {|--'text': 'hello world!'|}
*/
``