npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-json-inspector

v7.1.1

Published

React JSON inspector component

Downloads

49,843

Readme

React JSON Inspector Component

Component screenshot

React-based JSON inspector that features tree expansion and fast search.

Live demo

Installation

npm install react-json-inspector

Usage

var Inspector = require('react-json-inspector');
var data = { /* ... */ };

React.render(
    <Inspector data={ data } />,
    document.getElementById('inspector')
);

Make sure to include json-inspector.css in your stylesheet. Feel free to override or amend default styles, for instance, when using a dark background.

Run the example

cd /path/to/project
npm install
npm run watch

Then, visit http://localhost/path/to/project/example

Properties

props.data

The only required propery, JSON object or array to inspect.

props.className

The class name to be added to the root component element.

props.search

Search bar component that accepts onChange, data and query properties. Defaults to built-in search bar. Pass false to disable search.

props.searchOptions

Optional parameters for search (toolbar). Must be an object.

  • debounceTime, wait time (ms) between search field onChange events before actually performing search. This can help provide a better user experience when searching larger data sets. Defaults to 0.

props.query

Optional initial search query, defaults to an empty string.

props.interactiveLabel

Pass component factory that would receive the following properties:

  • value, either stringified property value or key value that is being interacted with,
  • originalValue, either the original property value or key value,
  • isKey, boolean flag to differentiate between interacting with keys or properties,
  • keypath, keypath of the node being interacted with, will be the same for keys and properties

Can be used to create custom input fields for JSON property names and primitive values, see #3 for more information.

props.onClick

Callback to be run whenever any key-value pair is clicked. Receives an object with key, value and path properties.

props.validateQuery

Function to check whether the entered search term is sufficient to query data. Defaults to (query) => query.length >= 2.

props.isExpanded

Optional predicate that can determine whether the leaf node should be expanded on initial render. Receives two arguments: keypath and value. Defaults to (keypath, query) => false.

props.filterOptions

Optional parameters for filterer (search). Must be an object.

  • cacheResults, Set to false to disable the filterer cache. This can sometimes provide performance enhancements with larger data sets. Defaults to true.
  • ignoreCase, Set to true to enable case insensitivity in search. Defaults to false.

props.verboseShowOriginal

Set to true for full showOriginal expansion of children containing search term. Defaults to false.