layer.open({ type: 1, skin:'layui-layer-demo', // closeBtn: 1, //Do not display the close button anim: 2, shadeClose: true, //Turn on the mask to close content: '<pre style="padding: 10px;">' + JSON.stringify(jsonstr, null, 5) + '</pre>', area: ['600px', '400px'] });Solution: JSON.stringify() method: Convert the json object to a json string, 5: means that there are 5 spaces indented by up to 10, but it is found that all the strings printed are still connected, because html ignores spaces Or tab, just use <pre></pre> tags.
json string format display
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325809561&siteId=291194637
Recommended
Ranking