【店小二】公告:
格式化json
| | |
功能介绍
1.对待格式化的
json
串进行格式化/压缩, 同时支持转义; 去注释会根据通过正则将#|//|--
替换处理
2.支持对字符串包含的json
串进行转义
3.对格式错误的会提示在什么位有错误
示例
1.正确格式的
{"name":"test","age":10,"addr":"四川成都","cls_info":[{"name":"篮球班","teacher":"张老师"},{"name":"美术班","teacher":"李老师"}]}
处理后
{
"name": "test",
"age": 10,
"addr": "四川成都",
"cls_info": [
{
"name": "篮球班",
"teacher": "张老师"
},
{
"name": "美术班",
"teacher": "李老师"
}
]
}
2.错误的格式
{"name":"test","age":10,"addr":"四川成都""cls_info":[{name":"篮球班","teacher":"张老师"},{"name":"美术班","teacher":"李老师"}]}
处理后
错误如下:
川成都"XXX"cls_info":[{n"
XXX附近有错误, 确认是否符号缺少或多余
说明: 错误出现在 XXX 附近, 建议进行搜索查看
3.包含json串
name=test&age=12&other={"name":"test","age":10,"addr":"四川成都","cls_info":[{"name":"篮球班","teacher":"张老师"},{"name":"美术班","teacher":"李老师"}]}
处理后
name=test&age=12&other={
"name": "test",
"age": 10,
"addr": "四川成都",
"cls_info": [
{
"name": "篮球班",
"teacher": "张老师"
},
{
"name": "美术班",
"teacher": "李老师"
}
]
}