0.9.1 • Published 7 years ago

@covalent/json-formatter v0.9.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

td-json-formatter

td-json-formatter renders a javascript object in Json format the same way the chrome/firefox console would render it using console.log().

Hovering on nodes will bring out a preview tooltip of the first 5 objects/properties of the node.

The tree is collapsable/expandable so you can navigate through its nodes.

API Summary

Properties:

NameTypeDescription
key?stringTag to be displayed as root of formatted object.
dataanyJS object to be formatted.
levelsOpen?numberLevels opened by default when JS object is formatted and rendered.

Setup

Import the CovalentJsonFormatterModule using the forRoot() method in your NgModule:

import { CovalentJsonFormatterModule } from '@covalent/json-formatter';
@NgModule({
  imports: [
    CovalentJsonFormatterModule.forRoot(),
    ...
  ],
  ...
})
export class MyModule {}

Usage

Simply add the component and pass the object to be formatted as a data input.

Example for HTML usage:

<td-json-formatter [data]="object" key="root" [levelsOpen]="1">
</td-json-formatter>