ZEN component to display JSON data

Primary tabs

JSON, ZEN, Caché


is there some kind ZEN component available (e.g. tree or anything), which can display raw JSON string  data nicely on ZEN webpage ?


JSON string contains primary nodes, subnodes, arrays.

  • 0
  • 0
  • 172
  • 0
  • 2


Hi Bapu,

There is a really simple solution, no Zen required.

Put some pre tags on your web page...

<pre id="json-preview-panel"></pre>

If your JSON is an object then...

document.getElementById("json-preview-panel").innerHTML=JSON.stringify(json, undefined, 2);

Note that the third argument in stringify() is the number of spaces to insert for prettifying.

If your JSON is a string already then you will need to convert it to an object and then back again...