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 dependenciesangular .module('jsonFormatterApp', [ 'ngCookies', ... 'jsonFormatter' ])
-
Use
<json-formatter>
directive<json-formatter json="{my: 'json'}" open="1"></json-formatter>
-
open
attribute accepts a number which indicates how many levels rendered JSON should be opened
See Examples here
If you are iterating in an array of objects using ng-repeat
, make sure you are using track by $index
to avoid adding extra $$hashKey
to your objects.
All modern browsers are supported. Lowest supported version of Internet Explorer is IE9.
Apache 2.0
See LICENSE