Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@redheadphone/react-json-grid

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@redheadphone/react-json-grid

React Component that converts JSON to grid table

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React JSON Grid

Interactive demos available below!
CodePen CodeSandbox Stackblitz

The library react-json-grid provides the React component JSONGrid, which is a user-friendly and versatile tool that enables you to effortlessly transform nested JSON objects or arrays into structured nested grid tables. This component has got you covered when dealing with big and complex JSON data, allowing you to display it in an organized manner.

Features

  • Ease of Integration: Seamlessly incorporate the component into your React applications without any hassle and no dependencies.
  • Nested JSON Support: Handle deeply nested JSON structures with ease, creating nested structured grid tables that are collapsible and expandible.
  • Highlight Magic: Select and highlight specific cells, rows, or columns in the grid tables to enhance the user interface and facilitate interaction.
  • Search Spotlight: Enhance the visibility of your JSON data with a search feature that effectively highlights cells matching with the search text.

Install

Run either one in your React project directory:

npm install @redheadphone/react-json-grid
yarn add @redheadphone/react-json-grid

Usage

Here's an example of how to use the react-json-grid library:

import React, { Component } from 'react'
import { JSONGrid } from '@redheadphone/react-json-grid'

class Example extends Component {
  render () {
    const data = {
      "id": "0001",
      "type": "donut",
      "name": "Cake",
      "ppu": 0.55,
      "batters":
        {
          "batter":
            [
              { "id": "1001", "type": "Regular" },
              { "id": "1002", "type": "Chocolate" },
              { "id": "1003", "type": "Blueberry" },
              { "id": "1004", "type": "Devil's Food" }
            ]
        },
      "topping":
        [
          { "id": "5001", "type": "None" },
          { "id": "5002", "type": "Glazed" },
          { "id": "5005", "type": "Sugar" },
          { "id": "5007", "type": "Powdered Sugar" },
          { "id": "5006", "type": "Chocolate with Sprinkles" },
          { "id": "5003", "type": "Chocolate" },
          { "id": "5004", "type": "Maple" }
        ]
    }
    return (
      <JSONGrid data={data}/>
    )
  }
}

Props

The JSONGrid component supports the following props:

NameTypeDescriptionDefault
dataobjectThe JSON object or array to be transformed into a grid table.undefined
defaultExpandDepthnumberThe depth to which the grid is expanded by default.0
defaultExpandKeyTreeobjectTree-like structure with all keys that needs to be expanded.undefined
searchTextstringThe text that needs to be searched in the JSON data.undefined

Contributing

Please kindly follow CONTRIBUTING.md to get started.

Acknowledgements

Keywords

FAQs

Package last updated on 01 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc