react-pretty-json
v2.0.2
Published
JSON to HTML generator with colors and collapsible brackets.
Downloads
490
Readme
react-pretty-json
Get started
- Install
react-pretty-json
in your project:
$ npm install react-pretty-json
- Import package and pass JSON.
import JsonView from 'react-pretty-json';
// ...
render() {
let obj = {
example: 'string',
number: 123,
boolean: true
};
return <JsonView json={obj} />;
}
- (Optional) Importing styles. You can reach it with `react-pretty-json/assets/json-view.css'.
import 'react/pretty-json/assets/json-view.css!';
Component props
| Prop | Type | Default | Description |
|---------|--------|---------|----------------------------------------|
| json*
| object | none | Generate object. |
| spaces | number | 4 | Parts that will be generated js files. |
*
- Required.