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

json-to-reactflow

v2.2.2

Published

Library to convert any json into a customisable diagram using react-flow

Downloads

11

Readme

json-to-reactflow

json-to-reactflow

Turn structured JSON into an editable, interactive visual flow powered by React Flow. Now supports deeply nested inputs/outputs, folders, dynamic forms, and visual routing.

npm 📦 Modular | ✨ Real-time Editing | 🧠 AI-Compatible | 🧩 Plug-and-play


🚀 Installation

npm install json-to-reactflow

⚡ Quick Start

import { JsonToReactFlow } from "json-to-reactflow";
import { flowJson, sidebarJson } from "./your-json-data";

function App() {
  return (
    <div style={{ width: "100vw", height: "100vh" }}>
      <JsonToReactFlow flowJson={flowJson} sidebarJson={sidebarJson} />
    </div>
  );
}

📘 Props

JsonToReactFlow Props

| Prop | Type | Required | Description | | ------------- | ----------------- | -------- | -------------------------------------------------------- | | flowJson | FlowJson | ✅ | JSON describing canvas, nodes, edges, and background | | sidebarJson | SideBarJsonType | ❌ | Optional. Sidebar with folders, templates, and previews. |


🧠 Flow JSON Structure

export interface FlowJson {
  export?: boolean;
  control?: boolean;
  minimap?: boolean;
  background?: {
    color?: string;
    bgcolor?: string;
    variant?: "dots" | "lines" | "cross";
    size?: number;
  };
  nodes: Node[]; // visit https://reactflow.dev/api-reference/types/node for more info
  edges: Edge[]; // visit https://reactflow.dev/api-reference/types/edge for more info
}

🧱 Sidebar JSON

SideBarJsonType

type SideBarJsonType = {
  folders: Folder[];
};

type Folder = {
  folderName: string;
  icon: string;
  item: Item[];
};

type Item = {
  label: string;
  icon: string;
  data: NodeData;
};

NodeData Interface

type NodeData = {
  name?: string;
  display_name?: string;
  display_icon?: string;
  description?: string;
  inputs?: InputField[];
  outputs?: Output[];
  [key: string]: any;
};

type InputField = {
  name: string;
  label?: string;
  placeholder?: string;
  type: "text" | "dropdown" | "checkbox" | "switch";
  options?: string[];
  defaultValue?: any;
  handlePresent?: boolean;
  value: string | boolean;
  required?: boolean;
};

type OutputField = {
  name: string;
  type: string;
  description?: string;
};

🧪 Example Data

For a more extensive example JSON, please visit FlowJson.ts on GitHub.

Sidebar Example

export const sidebarJson: TestJsonType = {
  folders: [
    {
      folderName: "Inputs",
      icon: "input",
      item: [
        {
          label: "Text Input",
          icon: "text",
          data: {
            name: "TextInputNode",
            display_name: "Text Input",
            description: "A simple text input node.",
            inputs: [
              {
                name: "textInput",
                label: "Enter text",
                type: "text",
                placeholder: "Type something...",
                required: true,
                handlePresent: true,
                value: "",
              },
            ],
            outputs: [
              {
                name: "textOutput",
                type: "text",
                description: "User-entered text",
              },
            ],
          },
        },
      ],
    },
  ],
};

Flow JSON Example

export const flowJson: FlowJson = {
  export: true,
  control: true,
  minimap: true,
  background: {
    color: "#000000",
    bgcolor: "#ffffff",
    variant: "cross",
    size: 1,
  },
  nodes: [
    {
      id: "node_1",
      type: "custom",
      position: { x: 100, y: 150 },
      data: {
        name: "OpenAIChatNode",
        display_name: "OpenAI Chat",
        description: "Send prompt to OpenAI and get results",
        inputs: [
          {
            name: "prompt",
            label: "Enter Prompt",
            type: "text",
            placeholder: "Enter your prompt...",
            required: true,
            handlePresent: true,
            value: "",
          },
          {
            name: "system_message",
            type: "text",
            label: "System Message",
            placeholder: "Type something...",
            required: true,
            handlePresent: true,
            value: "",
          },
          {
            name: "model",
            type: "dropdown",
            label: "Enter OpenAI model",
            options: ["gpt-3.5-turbo", "gpt-4"],
            placeholder: "Select model",
            required: true,
            handlePresent: false,
            value: "",
          },
          {
            name: "key",
            type: "text",
            label: "OpenAI API Key",
            placeholder: "",
            required: true,
            handlePresent: true,
            value: "",
          },
        ],
        outputs: [
          {
            name: "Response Text",
            type: "text",
            description: "The raw response from the model",
          },
          {
            name: "Full JSON Response",
            type: "data",
            description: "The complete JSON response object",
          },
        ],
      },
    },
    // Other nodes (node_2)...
  ],
  edges: [
    {
      id: "e1",
      source: "node_2",
      target: "node_1",
      targetHandle: "input-prompt",
      animated: true,
      label: "Prompt input",
    },
  ],
};

🛠 Features

  • ✅ Supports nested inputs and outputs
  • 🧰 Drag-and-drop templating via sidebar folders
  • ⚡ Real-time node editing using JSON Editor
  • 🎨 Custom icons(from lucide-react) and colors
  • 🔌 Connect nodes with dynamic handle IDs
  • 🧩 Extendable with new node types and logic

Here is the updated License section with the full MIT license text you provided:


📄 License

MIT License

Copyright (c) 2024 json-to-reactflow

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.