json-formatter

0.1.0 • Public • Published

JSON -> HTML Formatter

A JSON to HTML formatter for use with AMD/Non-AMD

Convert basic JSON datatypes (number, string, boolean, null, object, array) into an HTML fragments.

Code Extracted and modified to be a more reusable following the (Universal Module Definition) pattern.

Based On Firefox/Chrome Extension's :

Usage

new JSONFormatter(options).toHtml(json);

Supported options - number - string - boolean - object - array

Example options override

   var formatterOptions = {
          'string' : function(key,val) {
            if (key === 'id') return '<a class="link" data-request="'+val+'">'+val+'</a>';
            return false;
          }
        };

License

MIT/BSD

Readme

Keywords

none

Package Sidebar

Install

npm i json-formatter

Weekly Downloads

100

Version

0.1.0

License

none

Last publish

Collaborators

  • cmille142