A simple React component that renders an HTML table from a JSON object.
npm install react-json-to-html --save
A simple example. Download and run the demo for more examples, or browse the examples here.
import React from 'react';
import {JsonTable} from 'react-json-to-html';
class Nested extends React.Component {
const json = {
"Server Name": "foo",
"Description": "bar",
"Specs": {
"IP": "10.100.99.101",
"MAC": "00:0a:XX:9F:XX:16"
},
"Date": "Jan 1, 2018"
}
render() {
return (
<JsonTable json={json} />
)
}
}
export default JsonTable;
Name | Type | Required | Default | Possible Values | Description |
---|---|---|---|---|---|
json | [Object] | Yes | undefined | Any valid JSON object | The JSON that will get rendered as HTML table |
git clone https://github.com/grizzthedj/react-json-to-html.git
cd react-json-to-html
npm install
gulp demo
Browse http://localhost:8080
- Add more props to control styling and CSS
- More tests