react-json-syntax-highlighter

0.1.17 • Public • Published

React json syntax highlighter

This is a simple React component that serializes a JavaScript object as highlighted json string.

Getting Started

Install react component:

npm install --save react-json-syntax-highlighter

Import the component in your file:

import ReactJsonSyntaxHighlighter from 'react-json-syntax-highlighter'

Use it in your React component:

class MyComponent extends React.Component {
 
  render() {
    const obj = {
      stringProp: 'bar',
      numberProp: 1,
      booleanProp: true,
      nullProp: null,
      nestedProp: {
        nestedPropBar: 'bar'
      }
    }    
    return <ReactJsonSyntaxHighlighter obj={obj} />
  }
}

Package Sidebar

Install

npm i react-json-syntax-highlighter

Weekly Downloads

7,079

Version

0.1.17

License

Apache-2.0

Unpacked Size

577 kB

Total Files

20

Last publish

Collaborators

  • rpoetz