The string of JSON is one line. Is there a npm package that can format it into a newline style?

for example, the string
{"errcode": 0, "errinfo": "}
can be formatted as

when displayed.
{
    "errcode":0,
    "errinfo":""
}
Is there a plug-in implementation for

?
of course not only this kind of value is a string, value may be an array or an object, is there a formatted package?

Jun.20,2022

clipboard.png


if it were me, I would choose to use pretty-format .


I don't understand. Do you mean the replacement package for JSON.parse () and JSON.stringify ()?

Menu