Embed a JSON viewer widget on any website

Show JSON on your page as a tree your readers can open and close. Paste your JSON below, copy one snippet into your HTML, and the viewer shows it with each type in its own colour. Free, with no account.

Updated

A live example

This is the widget with a small API response in it. Press the arrows to open and close each object and array, or use Expand all, Collapse all and Copy JSON above the tree.

JSON viewer by JSON Editor Free

Make your snippet

Up to 200 KB. It must be valid JSON; repair it in the JSON editor first if it is not.

The snippet above shows the example. Paste your JSON and press Make the snippet.

How to embed the JSON viewer

  1. Paste your JSON into Your JSON. It can be an API response, a config file or any sample you write about.
  2. Pick a Theme, how many levels start open, and the height of the box on your page.
  3. Press Make the snippet. The preview shows exactly what your readers will see.
  4. Press Copy the snippet and paste it into your page’s HTML where the viewer should show.

The snippet

The snippet is an iframe and one line of credit. This is the one for the example above:

<iframe src="https://jsoneditorfree.com/embed/viewer/#j=Hcq9DoIwFAbQVzHffEMEYbmrbo6OxqGBS7mhLU1_4kB4d4PjSc4OncDtte8IwXgB4yF5vTjjIwgx6Sjg29AMBA2vso0ruKQqhGJsBr_h1C5FgwVhm-fzfwiTeglZt5DBOxY5z92D-4Hw_etpwW3THYRcY3QqCRyqc8cP" title="JSON viewer" width="100%" height="320" loading="lazy" allow="clipboard-write" style="border:1px solid #e5e5e5"></iframe>
<p style="margin:4px 0 0;font:13px/1.4 system-ui,sans-serif">JSON viewer by <a href="https://jsoneditorfree.com/embed/">JSON Editor Free</a></p>

The credit line, “JSON viewer by JSON Editor Free”, is a plain link back to this page. Keep it visible; whether it carries rel="nofollow" is up to you.

What the widget does

  • Shows any JSON as a tree: objects and arrays open and close, and closed ones show how many keys or items they hold, such as {3} or [12].
  • Colours keys, text, numbers and true, false and null apart, in the same colours as the editor’s tree view.
  • Keeps every number exactly as written, so long IDs such as 12345678901234567890 do not lose digits.
  • Expand all, Collapse all and Copy JSON, and a real button for every row, so it works with a keyboard and a screen reader.
  • Light, dark, or the reader’s own setting. It loads lazily and only its own small script: no fonts from other sites, no ads, no cookies.

Options in the address

The snippet maker writes these for you, but you can change them in the src address by hand:

  • theme=light or theme=dark fixes the look; without it the viewer follows the reader’s setting.
  • depth=0 to depth=20 sets how many levels start open; without it, two levels are open.
  • #json= followed by percent-encoded JSON works for a short hand-written example; the maker uses the shorter, compressed #j=.
  • The height attribute of the iframe sets the box’s height; the tree scrolls inside it.

Frequently asked questions

Is the JSON viewer widget free?

Yes. It is free for any website, with no account and no key. The snippet ends with one line, “JSON viewer by JSON Editor Free”, that links back to this page; please keep it.

Is my JSON sent to your server?

No. The JSON is packed into the part of the iframe address after the # sign, which browsers never send to a server. The viewer reads it there, in the reader’s browser. It sets no cookies and shows no ads.

How much JSON can I embed?

Up to 200 KB of JSON per snippet. The data is compressed into the address, and longer addresses fail in some browsers and content systems. For larger files, link to the editor instead.

Where can I paste the snippet?

Anywhere that accepts HTML with an iframe: your own pages, most blog and docs platforms, and content systems with an HTML or embed block. GitHub README files do not allow iframes.

Does it follow dark mode?

With Theme set to Auto it follows the reader’s light or dark setting. Light and Dark fix the look whatever the reader’s setting is.

How do I change the JSON later?

Make a new snippet with the new JSON and replace the old one. The JSON lives in the snippet itself, so nothing is stored that you would need to update here.

To edit, format, repair or compare JSON rather than show it, use the free online JSON editor; to read about its tree, table and text views, see JSON viewer: tree, table and text. What the site stores and why is in Privacy and ads.