/json-formatter

Angular directive for collapsible JSON in HTML

Primary LanguageJavaScriptOtherNOASSERTION

JSON Formatter

Build Status Code Climate

JSON Formatter is an AngularJS directive for rendering JSON objects in HTML with a collapsible navigation.

Screebshot

Usage

  • 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 json="{my: 'json'}" open="1"></json-formatter>
  • open attribute accepts a number which indicates how many levels rendered JSON should be opened

Demo

See Examples here

hashKey

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.

Browser Support

All modern browsers are supported. Lowest supported version of Internet Explorer is IE9.

License

Apache 2.0

See LICENSE