怎么实现类似命令行下 json.tool 的 pretty-print 一样的输出,最方便是用 json 格式化的 js ,不过不太想用。有轮子吗?
example:
```
{
"json": "obj"
}
```
example:
```
{
"json": "obj"
}
```
1
chemzqm Jan 17, 2016 |
2
just1 OP @chemzqm 感谢,不过这和 python -mjson.tool 似乎是一样的,我的意思可能没表达清楚,是将 json 格式化输出在网页上, so 换行是<br>,缩进要用
|
4
oott123 Jan 17, 2016 我觉得用样式实现这个需求比较好。
你可以考虑用 <pre> 标签包围你的 json 代码。 |