After pushing the element to the array, you could use JSON.stringify
The JSON.stringify() method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
for a stringified value in JSON notation of the array.
var issue = {
id: 1,
description: "This space is for description",
severity: "This is severity",
assignedTo: "Name of the assigned person",
status: "Issue Status "
},
issues = [];
issues.push(issue);
document.write('<pre>' + JSON.stringify(issues, 0, 4) + '</pre>');
For a better solution, because if the page is already rendered and while document.write generates a new page, you could use an <pre> tag and insert the stringified object.
var issue = {
id: 1,
description: "This space is for description",
severity: "This is severity",
assignedTo: "Name of the assigned person",
status: "Issue Status "
},
issues = [];
issues.push(issue);
document.getElementById('out').appendChild(document.createTextNode(JSON.stringify(issues, 0, 4)));
<pre id="out"></pre>
document.write("<pre>" + JSON.stringify(pushIssue, null, 4) + "</pre>")JSON.stringify(issues, 0, 4)works !