Skip to content

QuatroCode/react-pretty-json

Repository files navigation

react-pretty-json

NPM version dependencies Status devDependencies Status

Get started

  1. Install react-pretty-json in your project:
$ npm install react-pretty-json
  1. Import package and pass JSON.
import JsonView from 'react-pretty-json';

// ...

render() {
    let obj = {
        example: 'string',
        number: 123,
        boolean: true
    };
    return <JsonView json={obj} />;
}
  1. (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.

License

GPL-3.0