JSON Formatter is an AngularJS directive for rendering JSON objects in HTML with a collapsible navigation.
Install via Bower
bower install json-formatter --save
Add jsonFormatter
to your app dependencies
angular .module('jsonFormatterApp', [ 'ngCookies', ... 'jsonFormatter' ])
Use <json-formatter>
directive
<json-formatter open="1" json="{my: 'json'}"></json-formatter>
open
attribute accepts a number that indicated how many levels JSON should be open
To use dark theme add json-formatter-dark
class this directive. Note that json-formatter-dark
class make text and other elements lighter so they look good on a dark background.
json