v1.2.1

pardnchiu/NanoJSON

Last updated

NoteThis README was generated by SKILL, get the ZH version from here.



A LIGHTWEIGHT VISUAL JSON EDITOR BUILT WITH PURE JAVASCRIPT


npmDownloadsLicense




A zero-dependency vanilla JavaScript visual JSON editor with tree editing, per-node type switching, and lifecycle hooks

Table of Contents



Features


npm install @pardnchiu/nanojson · Documentation

  • Zero-dependency tree editing — A visual JSON tree editor built on pure JavaScript and native DOM APIs that embeds into any page without a frontend framework.
  • Per-node type switching — Each node switches live between string / number / boolean / object / array, rebuilding only its own subtree instead of the whole tree.
  • Cancelable lifecycle hooks — Returning false from a before* hook blocks the render or update, and continuous input collapses into a single update through a 300ms debounce.
  • Three data sources, built-in file actions — Initial data comes from a JavaScript object, a File object, or a URL, with built-in Open, Download, and Reset buttons.
  • Runtime read-only toggle — enable() / disable() switch read-only mode at any time, and nodes still expand and collapse while read-only.

Architecture


Full Architecture

graph TB
    A[Source: Object / File / URL] --> B[getJSON]
    B --> C[JSONEditor]
    C --> D[JSONEditorNode Tree]
    D --> E[DOM Renderers]
    C --> F[Lifecycle Hooks]
    D --> F
    C --> G[json / export Output]
  1. graph TB
  2. A[Source: Object / File / URL] --> B[getJSON]
  3. B --> C[JSONEditor]
  4. C --> D[JSONEditorNode Tree]
  5. D --> E[DOM Renderers]
  6. C --> F[Lifecycle Hooks]
  7. D --> F
  8. C --> G[json / export Output]

License


This project is licensed under the MIT LICENSE.

Author


Just open an issue to share an idea.
nanojson contributors


©️ 2025 邱敬幃 Pardn Chiu
中文