TrialViewer is a vanilla JavaScript tool for visualising trial JSON data. We use JSONViewer to display json structure.
Demo Site: oncokb.github.io/trial-viewer
- Create new instance of JSONViewer object.
var jsonViewer = new JSONViewer();
- Append instance container to the DOM using "getContainer()" method.
document.querySelector("#json").appendChild(jsonViewer.getContainer());
- Visualise json using "showJSON()" method, which accepts 3 arguments - json file, optional: visualise to max level (-1 unlimited, 0..n), optional: collapse all at level (-1 unlimited, 0..n).
jsonViewer.showJSON(jsonObj); // visualize the whole json structure. jsonViewer.showJSON(jsonObj, 1); // visualise json to max level 1. jsonViewer.showJSON(jsonObj, null, 1); // collapse all at level 1.