pretty-json-view
TypeScript icon, indicating that this package has built-in type declarations

0.1.11 • Public • Published

Pretty Json View

This is a react component for displaying json

Get Started

Install

npm i pretty-json-view

Usage

import {Component} from 'react';
import PrettyJsonView from 'pretty-json-view';
import "pretty-json-view/style.css"

export class Hello extends Component {
    render(){
        let data = {
            code: 0,
            msg: "success",
            data: {
                "username": "linkduan",
                "history": ["home", "school", "office"]
            }
        };
        // Optional: tagInfo will show at then end of json fields
        let tagInfo = {
            "code": "status code",
            "msg": "status message",
            "data.username": "user's name",
            "data.history": "history",
            "data.history.$": "history item"        
        };
        return <div>
            <PrettyJsonView data={data} tagInfo={tagInfo}/>
        </div>
    }
}

It will show like this:

Package Sidebar

Install

npm i pretty-json-view

Weekly Downloads

1

Version

0.1.11

License

none

Unpacked Size

9.6 kB

Total Files

6

Last publish

Collaborators

  • linkduan