current position:Home>Record the front-end display of JSON data formatting

Record the front-end display of JSON data formatting

2021-08-23 07:57:07 laomao

Format as 4 Space indent

let res = JSON.parse(response)
this.logString = JSON.stringify(res,null,4)

But put it in html in , The space will be changed to 1 individual , So we need to add automatic line feed , Keep the original style of all spaces
white-space:pre-wrap

copyright notice
author[laomao],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2021/08/20210823075704995s.html

Random recommended