【文件属性】:
文件名称:json-formats:json格式化
文件大小:51KB
文件格式:ZIP
更新时间:2021-05-29 12:21:58
json format JavaScript
json-formats
格式化json字符串,以便于阅读
使用方式:
const format = require('json-formats');
const res = format(json对象||json字符串, {})
参数配置:
方法第二个参数接收一个对象,对象内容如下:
{
lineBreak: '\n', // 换行符
indentStr: ' ' // 缩进 默认两个空格
}
示例:
json字符串
{"rewardable":true,"setting":{"description":"小礼物走一走,来简书关注我","default_amount":200},"total_rewards_count":2,"reward_buyers":[{"avatar":"https://upload.jianshu.io/user
【文件预览】:
json-formats-main
----__test__()
--------index.test.js(4KB)
----README.md(2KB)
----libs()
--------format.js(5KB)
----.editorconfig(207B)
----.gitignore(19B)
----index.js(66B)
----package-lock.json(176KB)
----package.json(645B)