I'm copy-pasting JSON from a server log into Postman. The JSON in the server log is single-line like this:
{"a": 1, "b": 2}
but I want it to be multi-line like this:
{
"a": 1,
"b": 2
}
Is there a way to do this in Postman or elsewhere other than manually?
I'm copy-pasting JSON from a server log into Postman. The JSON in the server log is single-line like this:
{"a": 1, "b": 2}
but I want it to be multi-line like this:
{
"a": 1,
"b": 2
}
Is there a way to do this in Postman or elsewhere other than manually?
Share Improve this question edited Dec 16, 2021 at 9:50 Mark Rotteveel 109k229 gold badges156 silver badges220 bronze badges asked Dec 14, 2021 at 3:21 gkeenleygkeenley 7,41816 gold badges77 silver badges178 bronze badges 1- this process is called JSON beautify and is available in almost all popular programming languages – tsamridh86 Commented Dec 14, 2021 at 3:29
3 Answers
Reset to default 4I don't know about postman but in VS Code you can format document just " right-click mouse btn in VScode > format document with > JSON Language Feature " although it works only if its fully JSON file not js.
sorry I want to write it in a ment but I don't have many reputations
Postman has a button "Beautify" in the top right corner. Click it to be happy.
You can parse the JSON, then stringify it again:
const json = `{"a": 1, "b": 2}`;
const res = JSON.stringify(JSON.parse(json), 0, 2)
console.log(res)