Library / SDK
josdejong/svelte-jsoneditor avatar
josdejong/svelte-jsoneditor

svelte-jsoneditor: a JSON editor with a tree view, a schema validator and a 512 MB ceiling

A web-based tool to view, edit, format, repair, query, transform, and validate JSON

1,271 stars152 forksTypeScriptNOASSERTION

At a glance

What is it?
svelte-jsoneditor is a TypeScript library for viewing, editing, formatting, repairing, querying, transforming and validating JSON, with three editing surfaces, a text mode, a tree mode and a table mode, plus JSON schema validation. It ships as a Svelte component and as a vanilla bundle, and version 3.x requires Svelte 5 while 2.x covers Svelte 3 and 4.
Who is it for?
svelte-jsoneditor suits a web application that needs to show users structured JSON and let them edit it safely, and that wants schema validation and a repair function rather than a plain textarea. It is the wrong choice if you only need a read-only JSON viewer, since the editing machinery, the schema machinery and the two bundles are more than that use needs, and a poor fit for a Svelte 3 or 4 codebase unless you accept the 2.x line.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 92 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 24, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What the library is: JSON editing as a component, not as a page

svelte-jsoneditor is described as a web-based tool to view, edit, format, repair, query, transform and validate JSON, and the homepage is jsoneditoronline.org, where the editor can be tried directly. The feature list covers view and edit JSON, a low level text editor alongside a high level tree view and table view, formatting and compacting, sorting, querying, filtering and transforming, repairing JSON, JSON schema validation with pluggable custom validation, colour highlighting, undo and redo, search and replace, and utilities such as a colour picker and a timestamp tag. It handles large JSON documents up to 512 MB. The distinction that matters for an integrator is that this is a library and a component, not a hosted page, so the evaluation is about the API surface and the build integration rather than about the interface.

Three editing surfaces, and why the text mode is not an afterthought

The editor has three views, and the README explains the relationship. There is a low level text editor and a high level tree view and table view. The text mode is the raw JSON with syntax highlighting, and the tree mode is the expanded object tree where you can add, rename and move properties, and the table mode presents an array of objects as a table. The screenshots at the top of the README show all three. The practical design point is that a user editing structured data has two different jobs, and the two need different affordances. A tree view is right for a targeted change to one field in a large document, and the text mode is right when you want to see the document as it will be transmitted. Having both, and letting the user switch, is the difference between an editor and a viewer with an edit button.

The content model: a text field and a json field, one of which is undefined

The API is built around a content object, and the shape is worth understanding because it explains several design decisions. The content is an object of the form { json: unknown } or { text: string }, and in every example the text field is set to undefined with a comment saying it can be used to pass a stringified JSON document instead. So the editor holds the document in one of two representations, and the parent decides which. A parent that has parsed JSON passes the json field, a parent that has a raw string passes the text field, and the editor converts as needed. The change handler receives the updated content, the previous content, and a details object containing contentErrors and patchResult, and the README comment repeats the shape of the content object. The error and patch information arriving with every change is what makes validation usable rather than merely present.

html
<script>
  import { JSONEditor } from 'svelte-jsoneditor'

  let content = {
    text: undefined,
    json: {
      array: [1, 2, 3],
      boolean: true,
      color: '#82b92c',
      null: null,
      number: 123,
      object: { a: 'b', c: 'd' },
      string: 'Hello World'
    }
  }
</script>

<div>
  <JSONEditor bind:content />
</div>

Svelte two-way binding versus the vanilla class interface

There are two ways to use the editor and the difference is more than syntax. In Svelte you can use a two-way binding with bind:json, or a one-way binding with a change handler that receives the updated content, the previous content and the details object. The one-way form is the more explicit of the two, because the parent decides when to accept a change rather than the binding assigning for you. Outside Svelte, the library provides a vanilla bundle and a class-style interface through createJSONEditor, where you pass a target element and a props object, and the returned editor exposes methods to get, set and update data and to subscribe to changes, plus updateProps to update properties. The README is clear that in a framework like React, Vue or Angular you will need to write some wrapper code around the class interface, which is the honest cost of framework independence.

js
import { createJSONEditor } from 'vanilla-jsoneditor'

const content = { text: '[1,2,3]' }

const editor = createJSONEditor({
  target: document.getElementById('jsoneditor'),
  props: {
    content
  }
})

Two packages, one editor, and the Svelte version floor

Installation comes in two flavours and the naming is a little confusing at first. For a Svelte project you install svelte-jsoneditor with npm install svelte-jsoneditor, and there is a version constraint that catches people out: [email protected] requires Svelte 5, and if you use Svelte 3 or 4 you should install [email protected]. For vanilla JavaScript or frameworks like SolidJS, React, Vue and Angular, you install vanilla-jsoneditor, which is the same editor without the Svelte wrapper. The library is written with Svelte but can be used in plain JavaScript and in any framework, and it requires a browser from March 2022 or newer, which is a hard floor you should check against your browser support policy rather than assume.

bash
npm install svelte-jsoneditor
bash
npm install vanilla-jsoneditor

The standalone bundle and the double bundling problem

The vanilla library offers two import forms, and the README explains when to use which. If your project has a bundler such as Vite, Rollup or Webpack, it is best to use the default ES import of createJSONEditor from vanilla-jsoneditor. If you want to use the library straight in the browser, you use the provided standalone ES bundle from vanilla-jsoneditor/standalone.js, and there is a commented CDN alternative that the documentation marks as not recommended for production use. The caveat is specific and worth reading before you pick the standalone bundle. It contains all the dependencies of vanilla-jsoneditor, for example lodash-es and Ajv, and if you use some of those dependencies in your project too, they will be bundled twice, leading to a needlessly large application size. The recommendation is to prefer the default import so dependencies can be reused, and the reasoning applies to any editor that ships its own validation engine.

Wrappers, the 512 MB claim, and where the project stands

Because the editor is framework independent but not framework native, the project points at wrapper libraries maintained elsewhere for Vue, json-editor-vue and vue3-ts-jsoneditor, and for Django, django-svelte-jsoneditor. A working example for each of React, Vue and plain JavaScript is provided as a StackBlitz, and the repository has an examples/browser/ directory and Svelte routes under src/routes/examples. The size claim is stated plainly: handles large JSON documents up to 512 MB. That figure is a limit rather than a benchmark, and a real application with a document that size needs to think about the browser memory it is asking for. On upkeep, the default branch is develop, the last push was on 2026-07-24, the recent releases are v3.11.0 on 2025-12-10, v3.12.0 on 2026-03-30 and v3.13.0 on 2026-07-24, and the repository is not archived.

Editorial conclusion

svelte-jsoneditor suits a web application that needs to show users structured JSON and let them edit it safely, and that wants schema validation and a repair function rather than a plain textarea. It is the wrong choice if you only need a read-only JSON viewer, since the editing machinery, the schema machinery and the two bundles are more than that use needs, and a poor fit for a Svelte 3 or 4 codebase unless you accept the 2.x line. Before adopting it, check which major you need, since [email protected] requires Svelte 5 and 2.x is the line for Svelte 3 or 4, and if you use the standalone browser bundle, read the note about dependencies such as lodash-es and Ajv being bundled twice.

Frequently asked questions

What does svelte-jsoneditor do?

It is a library to view, edit, format, repair, query, transform and validate JSON. It has a low level text editor plus a high level tree view and table view, supports formatting and compacting, sorting, querying, filtering and transforming, repairing JSON, and JSON schema validation with pluggable custom validation, and it handles documents up to 512 MB.

Which Svelte version does svelte-jsoneditor 3.x need?

[email protected] requires Svelte 5. If you use Svelte 3 or 4 you should install [email protected] instead. The library also requires a browser from March 2022 or newer.

How do I use the editor outside a Svelte project?

Install vanilla-jsoneditor and use createJSONEditor with a target element and a props object. In a framework like React, Vue or Angular you will need to write some wrapper code around the class interface, and there are wrapper libraries available for Vue and Django.

Should I use the standalone bundle of vanilla-jsoneditor?

Only if you need to run it straight in the browser without a bundler. The standalone bundle contains all dependencies such as lodash-es and Ajv, so if your project also uses them they get bundled twice and the application becomes needlessly large. With a bundler like Vite, Rollup or Webpack, prefer the default import.

What is the content object passed to the JSONEditor component?

It is an object of the form { json: unknown } or { text: string }, and in the examples the text field is left undefined with a comment that it can be used to pass a stringified JSON document instead. The change handler receives the updated content, the previous content and a details object with contentErrors and patchResult.

Official sources

  1. Issues
  2. josdejong/svelte-jsoneditor on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/josdejong-svelte-jsoneditor.svg)](https://hysenlabs.com/projects/josdejong-svelte-jsoneditor)

Was this useful?