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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@karthiksripad/json-craft

v1.0.0

Published

Interactive JSON editor with dual-pane interface and nested JSON support

Downloads

7

Readme

@karthiksripad/json-craft

A modern, interactive JSON editor library built with React, TypeScript, and Tailwind CSS. Features dual-pane editing with real-time synchronization between text and visual tree editors, and advanced nested JSON support.

Features

Core Functionality

  • Dual-Pane Interface: Split view with raw text editor (left) and visual tree editor (right)
  • Real-time Synchronization: Changes in either pane instantly reflect in the other
  • Resizable Panes: Adjust the split between editors with draggable handle
  • Layout Options: Switch between horizontal and vertical layouts

Text Editor (Left Pane)

  • JSON syntax highlighting
  • Real-time validation with error reporting
  • Auto-formatting with "Format" button
  • Line and character count display
  • Error highlighting with descriptive messages

Visual Tree Editor (Right Pane)

  • Interactive tree structure display
  • Expandable/collapsible nodes
  • Data type indicators with color coding
  • Inline editing of values
  • Add/delete properties and array items
  • Drag-and-drop reordering
  • Breadcrumb navigation

Search & Navigation

  • Search across keys and values
  • Case-insensitive search
  • Result highlighting with current result indicator
  • Navigate between search results
  • Auto-expand paths containing results

Import/Export

  • Import JSON from file upload
  • Export to JSON file
  • Copy to clipboard
  • Clear all data with confirmation

User Experience

  • Dark/Light theme toggle with system preference support
  • Keyboard navigation support
  • Error prevention and validation
  • Responsive design
  • Modern UI with shadcn/ui components

Installation

npm install @karthiksripad/json-craft

Peer Dependencies

Make sure you have React 17+ installed:

npm install react react-dom

Quick Start

import { JsonEditor } from '@karthiksripad/json-craft';
import '@karthiksripad/json-craft/style.css';

function App() {
  const [jsonData, setJsonData] = useState(null);

  return (
    <div style={{ height: '500px' }}>
      <JsonEditor
        value={jsonData}
        onChange={(value, text) => {
          setJsonData(value);
          console.log('JSON changed:', { value, text });
        }}
      />
    </div>
  );
}

API Reference

JsonEditor Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | value | string \| JsonValue | '' | Initial JSON value (string or parsed object) | | onChange | (value: JsonValue \| null, jsonText: string) => void | - | Called when JSON changes | | defaultLayout | 'horizontal' \| 'vertical' | 'horizontal' | Initial layout orientation | | showToolbar | boolean | true | Show/hide the toolbar | | allowImportExport | boolean | true | Enable import/export functionality | | readonly | boolean | false | Make the editor read-only | | className | string | '' | Additional CSS class | | style | React.CSSProperties | - | Inline styles | | placeholder | string | 'Enter JSON here...' | Placeholder text for empty editor |

Individual Components

You can also use individual components for more control:

import { JsonTextEditor, JsonTreeEditor } from '@karthiksripad/json-craft';
import '@karthiksripad/json-craft/style.css';

// Text editor only
<JsonTextEditor
  value={jsonString}
  onChange={setJsonString}
  isValid={isValid}
  readonly={false}
/>

// Tree editor only
<JsonTreeEditor
  data={jsonData}
  onChange={setJsonData}
  isValid={isValid}
  readonly={false}
/>

Advanced Usage Examples

Read-only Mode

<JsonEditor
  value={apiResponse}
  readonly={true}
  showToolbar={false}
  onChange={() => {}} // Won't be called in readonly mode
/>

Custom Styling

<JsonEditor
  value={data}
  onChange={handleChange}
  className="my-custom-editor"
  style={{
    height: '600px',
    border: '1px solid #ccc',
    borderRadius: '8px'
  }}
/>

Handling Nested JSON Strings

The editor automatically detects and parses nested JSON strings (common in API responses):

{
  "config": "{\"theme\":\"dark\",\"settings\":[1,2,3]}"
}

Click the eye icon next to JSON strings to expand and edit them inline.

Form Integration

import { useForm } from 'react-hook-form';

function ConfigForm() {
  const { setValue, watch } = useForm();
  const config = watch('config');

  return (
    <div>
      <label>API Configuration:</label>
      <JsonEditor
        value={config}
        onChange={(value) => setValue('config', value)}
        placeholder="Enter your API configuration..."
      />
    </div>
  );
}

TypeScript Types

import type {
  JsonValue,
  JsonObject,
  JsonArray,
  JsonEditorProps
} from '@karthiksripad/json-craft';

const data: JsonObject = {
  name: "John",
  scores: [1, 2, 3] as JsonArray
};

Technology Stack

  • React 19 - UI framework
  • TypeScript - Type safety
  • Vite - Build tool and dev server
  • Tailwind CSS - Styling
  • shadcn/ui - Component library
  • Lucide React - Icons
  • react-resizable-panels - Resizable layout

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run npm run build to ensure no errors
  5. Submit a pull request

License

MIT License - see LICENSE file for details