1.利用pre标签
body{
padding-top: 20px;
}
#data_info{
width: 100%;
font-size: 16px;
white-space: pre-wrap;
word-wrap: break-word;
}
.string { color: green; }
.number { color: darkorange; }
.boolean { color: blue; }
.null { color: magenta; }
.key { color: red; }
var show = document.getElementById('data_info');
var jsondata = {"id": {"first":1, "second":2, "third":3, "fourth": [4, 5, 6, 7], "fifth": 5}, "name": {"ZS": "张三", "LS": "李四"}};
show.innerHTML = pretifyJson(jsondata,true);
/**
* [pretifyJson json格式化打印]
* @param {[type]} json [description]
* @param {Boolean} pretify [description]
* @return {[type]} [description]
*