格式化json

时间:2023-12-17 19:03:56

格式化输出JSON

格式化json

var obj = {"args0":{"asynTarget":false,"atomicList":[{"amount":20000,"bankNo":"","bankProCode":"","executeNo":"1","fundAccountOrder":"","fundAccountOrig":"0000000264001","fundAccountTarget":"","memo":"抵顶保存冻结,单据号:IW1704140358017009","menuId":"","moneyType":"USD","speTransNo":"","subTransCode":"130301","tradeCode":"03","userIdOrig":"0000000264","userIdTarget":"","writeOffBizNo":""}],"backAsynTarget":false,"bankCheckMark":"","busiName":"冻结货币资金(抵顶)","exchangeId":"0","limitOut":false,"marketId":"","memo":"货币抵顶保存冻结,单据号:IW1704140358017009","needTransaction":"y","operator":"0000000264","outBizNo":"LFB1704140358017010","systemCode":"FI","tradeCode":"","transDate":"20170414","version":"1.0"}}
var str = JSON.stringify(obj, undefined, 4)
document.querySelector('pre').innerHTML = str str = str.replace(/\n/g, '<br>')
.replace(/\s/g, '&nbsp;') document.querySelector('div').innerHTML = str