// The JSObject that you want to render
var data = {
hello: [1,2,3,4],
there: {
a:1,
b:2,
c:["hello", null]
}
};
document.getElementById("container").appendChild(
renderjson(data)
);
console.log(renderjson({ hello: [1,2,3,4], there: { a:1, b:2, c:["hello", null] } }));
<div id="container"></div>
.renderjson a { text-decoration: none; }
.renderjson .disclosure { color: crimson;
font-size: 150%; }
.renderjson .syntax { color: grey; }
.renderjson .string { color: red; }
.renderjson .number { color: cyan; }
.renderjson .boolean { color: plum; }
.renderjson .key { color: lightblue; }
.renderjson .keyword { color: lightgoldenrodyellow; }
.renderjson .object.syntax { color: lightseagreen; }
.renderjson .array.syntax { color: lightsalmon; }
#container{
text-shadow: none;
background: #303030;
padding: 1em;
}
External resources loaded into this fiddle: