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

rc-json-editor

v2.0.35

Published

A simple JSON Editor React Component

Downloads

768

Readme

rc-json-editor

A simple react component that handles your JSON editing woes in a wink 😉

The What and Why

This is a simple React Component (and hence the "rc") that takes your JSON as input and renders a beautiful UI which allows you to edit the JSON on the go. I searched the web for this component for my specific needs and was not able to find one. And so, I created one.

Why do you want a json-editor component?

You may think, why waste time on a component, while you can put content-editable="true" on a code tag and allow your users to edit their JSON themselves. But the catch here is, not everyone knows the syntax of a JSON. This tool could help in that case.

This is not the "Perfect" component

It is just a start, issues and PRs are welcome if you find this component helping your needs. Find the Demo Storybook

The How?

This component purely works on a custom Datatype called JsonArray which extends the Array class. So you know, it is an array of sorts, with some additional custom components.

This is a in-progress doc, so please visit the JsonArrayClass.ts file for the complete implementation.

Changes are welcome so are feedbacks.

Dependencies

There are no big dependencies per se.

  • react
  • react-dom

TBD: Things to do

  • Provide the full control of the rendering part as a prop, so that users can render the UI based on their needs.
  • Provide event callbacks

Usage

Install the package from npm

npm install rc-json-editor

This is a simple usage example

import { JsonEditor } from 'rc-json-editor';

<JsonEditor
  data={{
    order: {
      id: 'order_124831sf23j123',
      isSuccess: true,
      price: 70000
    }
  }}
  onChange={() => {}}
/>

Props

  • data - A JSON that needs to be viewed/edited
  • onChange - A callback that gets executed when the data is updated

Storybook

Find the demo here - https://samuellawrentz.github.io/rc-json-editor/?path=/story/introduction--page

NPM Package

NPM package link - https://www.npmjs.com/package/rc-json-editor