Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

pretty-object-string

1.1.1 • Public • Published

PrettyJson

NPM version Test coverage npm download

Usage

There is a vscode extension Pretty js/json use this package to format pretty json or javascript object string.

PrettyJson can format javascript string like this.

let a = `{
  code: 200,
  msg: "success",
  datas:[{
    name:'小王',
    age:2
  },{
    'name':"校长",
    age:10
  }]
}`;
 
const prettyJson = require("../lib/index");
 
const out = prettyJson(a);
console.log(out);
/** 
 * {
 * "code": 200,
 * "msg": "success",
 * "datas": [
 * {
 * "name": "小王",
 * "age": 2
 * },
 * {
 * "name": "校长",
 * "age": 10
 * }
 * ]
 * }
 */

Install

npm i pretty-object-string

DownloadsWeekly Downloads

0

Version

1.1.1

License

ISC

Unpacked Size

34 kB

Total Files

16

Last publish

Collaborators

  • avatar