Answers for "format json nicely html"

1

format JSON code javascript

console.log(JSON.stringify({ alpha: 'A', beta: 'B' }, null, '\t'));
// Result:
// '{
//     "alpha": A,
//     "beta": B
// }'
Posted by: Guest on November-25-2020
1

display object with indentaion in html

var data = {
  "data": {
    "x": "1",
    "y": "1",
    "url": "http://url.com"
  },
  "event": "start",
  "show": 1,
  "id": 50
}


document.getElementById("json").textContent = JSON.stringify(data, undefined, 2);

// <pre id="json"></pre>
Posted by: Guest on August-26-2020

Browse Popular Code Answers by Language