JSON String Formatter
A lightweight JSON string formatter which can prettify your JSON string without parsing it to object.
Install
npm install --save json-string-formatter
or
yarn add json-string-formatter
Usage
- Import
const format =
- Basic usage
let input = "{'text': 'hello world!'}";let output = ; /** * output = `{ * 'text': 'hello world!' * }` * /
- Customized indent and linebreak
let input = "{'text': 'hello world!'}";let output = ; /** * output = `{|--'text': 'hello world!'|}` */