I am quite new to web development and hence have a doubt in implementing this.
var obj = [[{ name: "John", age: 30, city: "New York"}, { name: "Ken", age: 35, city: "New Orleans"} ]];
var strObj = JSON.stringify(obj);
var dmodPayload = modPayload.replace(/[{]/g, '\n');
I want the array elements to be printed on separate lines. The output that I get here is [[\n"name":"John","age":30,"city":"New York,\n"name":"Ken","age":35,"city":"New Orleans"}]]
But I want it as
[[
"name":"John","age":30,"city":"New York"},
"name":"Ken","age":35,"city":"New Orleans"}]]
If I use < br >, it gets replaced as < br > and no line break is see. How do I insert a break between two array elements of a JSON object after it has been converted into a string?