display object with indentaion in html

Solutions on MaxInterview for display object with indentaion in html by the best coders in the world

showing results for - "display object with indentaion in html"
Emmanuelle
13 Jun 2018
1var data = {
2  "data": {
3    "x": "1",
4    "y": "1",
5    "url": "http://url.com"
6  },
7  "event": "start",
8  "show": 1,
9  "id": 50
10}
11
12
13document.getElementById("json").textContent = JSON.stringify(data, undefined, 2);
14
15// <pre id="json"></pre>