Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

JSON Viewer

JSON Schema (draft 2020-12)

Reading the data…

Input

Paste JSON to view, or

CtrlV paste to view

Ready
Runs in your browser. Nothing you paste is uploaded unless you share it.

Open JSON as a searchable tree: click any value for its JSONPath, JavaScript and jq path

Paste JSON or open a file to see it as a table of keys, values and types. Click any value for its JSONPath, JavaScript and jq path, find a key or value, or type a JSONPath such as $..email. Big files open in a background thread, so the page keeps answering.

How to use it

  1. Paste JSON, drop a file or open one: up to 50 MB on a computer, 10 MB on a phone or tablet. NDJSON (one document per line) works too.
  2. Open and close values with a click or the arrow keys; Expand all and Collapse all do the whole document.
  3. Click a value to see its three paths and copy one, or type in Find or JSONPath to mark every match. Copy matches gives them as a JSON array.
  4. JSON Schema makes a schema the whole document passes, to copy or download.

Examples

Every email, wherever it is

Input
JSONPath: $..email
{"data": [{"customer": {"email": "ada@example.com"}}, {"customer": {"email": "grace@example.com"}}], "meta": {"page": 1}}
Result
["ada@example.com", "grace@example.com"]

.. looks at every level below, so the path doesn’t need to know where the key sits.

One field from every item

Input
JSONPath: $.items[*].sku
{"items": [{"sku": "A-1", "qty": 2}, {"sku": "B-7", "qty": 1}]}
Result
["A-1", "B-7"]

The last item

Input
JSONPath: $.items[-1]
{"items": ["draft", "sent", "paid"]}
Result
["paid"]

A negative index counts from the end.

An id longer than a JavaScript number

Input
JSONPath: $.id
{"id": 9007199254740993}
Result
[9007199254740993]

JSON.parse would give 9007199254740992. The viewer keeps the digits as written and marks the value “exact”.

A field from each line of NDJSON

Input
JSONPath: $.level
{"level": "info", "msg": "order shipped"}
{"level": "error", "msg": "card declined"}
Result
["info", "error"]

Each line is its own document, so $ is each line in turn, as jq reads them.

Items that pass a filter

Input
JSONPath: $.items[?@.qty > 1 && @.sku != 'GIFT'].sku
{"items": [{"sku": "MUG-01", "qty": 2}, {"sku": "TEE-07", "qty": 1}, {"sku": "GIFT", "qty": 3}]}
Result
["MUG-01"]

@ is the item being tested. The older form [?(@.qty > 1)], with parentheses, reads the same.

A slice, and a list of names

Input
JSONPath: $.rows[-2:]['id','total']
{"rows": [{"id": 1, "total": 5}, {"id": 2, "total": 8}, {"id": 3, "total": 13}]}
Result
[2, 8, 3, 13]

The last two rows, then each row’s id and total, in the order the list names them.

Big files without a freeze

A viewer that builds an object for every value on the page’s own thread stops the tab while a file of tens of megabytes loads. Here the parsing runs in a background thread and writes each value as a row of a few numbers that point into your text. The rows move to the page without a copy, the table draws only the lines on screen, and Find and JSONPath work through big documents a slice at a time between frames.

A phone or tablet gets a lower limit than a computer, because it has less memory. Each limit sits where we measured the page staying quick; a bigger file is not read at all, and the page says so.

The JSONPath it reads

JSONPath as RFC 9535 defines it: names, indexes, wildcards, slices, lists and filters, at one level or at every level below. A filter compares with == != < <= > >=, joins tests with && || and !, and can call length(), count(), value(), match() and search(). A path the RFC doesn’t allow gets a message under the field saying where reading stopped and why. Checked against the JSONPath working group’s compliance tests; the only differences are on purpose: spaces around the whole path are allowed, and a lone surrogate escape (\ud800), which a JSON key may hold, is read.

PathMeans
$The whole document (each line, for NDJSON)
$.user.emailKey "email" inside key "user"
$['first name']A key with a space or another special character
$.items[0]The first item of "items"; [-1] is the last
$.items[*].id"id" of every item
$..idEvery "id", at any level
$.user.*Every value inside "user"
$.items[0:5]Items 0 to 4; [::2] every other one, [::-1] all, last first
$.items[0,2] or $.user['name','email']A list: each in the order written
$.items[?@.price < 10]Items whose price is under 10
$..[?@.status == 'failed' || !@.ok]Values at any level that failed or have no true ok
$.users[?match(@.email, '.*@example\.com')]Users whose whole email fits the pattern; search() finds it anywhere
$.orders[?count(@.items[*]) > 2]Orders with more than two items; length(@.name) counts characters

Sources: RFC 9535: JSONPath

Three paths for one value

The chosen value shows the path to it three ways, each with its own Copy button. JSONPath ($.data[0].email) is what JSONPath libraries, Postman tests and many API tools take. JavaScript (json.data[0].email) is the code that reads it from a parsed object named json. jq (.data[0].email) goes straight into a jq filter on the command line.

Keys that are not plain names are quoted the way each one needs: $['first name'] in JSONPath, json["first name"] in JavaScript, .["first name"] in jq.

Sources: jq manual

Numbers stay as written

A JavaScript number holds integers exactly only up to 9,007,199,254,740,991. JSON.parse turns a longer id such as 9007199254740993 into 9007199254740992, and a viewer built on it shows the wrong id. This viewer doesn’t turn your values into JavaScript numbers: each value is shown and copied exactly as it is in your text, and a number with more digits than JavaScript holds is marked “exact”.

Sources: MDN: Number.MAX_SAFE_INTEGER

Questions

Is my JSON uploaded?
No. Everything runs in your browser, so your JSON stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. When it holds a key or token, the page flags it and recent work keeps only the file’s name.
Can it open NDJSON or JSON Lines?
Yes. When each line holds its own value, the viewer shows one row per line ("line 1", "line 2"…), and JSONPath runs on each line, as jq does.
Why does a number say “exact”?
It has more digits than a JavaScript number holds, so JSON.parse would change it. The viewer shows and copies it as written; in your own code, read it as a string or with a parser that keeps big numbers.
Can it make a JSON Schema from my data?
Yes: JSON Schema in the bar writes a draft 2020-12 schema that every value in the open document passes. Values at the same place are merged (all items of a list, every line of NDJSON); a key is required when every object at its place has it, whole numbers are "integer", and a place holding more than one kind lists them. Copy or download it, then tighten it by hand (formats, limits, enums).
What does it show for colors, dates and links?
The chosen value is also shown as what it stands for: a color (#3366cc, rgb() or hsl()) as a swatch with its hex, RGB and HSL; an ISO 8601 date or a Unix time in seconds or milliseconds as local time, UTC and how long ago; a URL as its scheme, host, port, path, fragment and query parameters; a data: image as the picture. Nothing is fetched, so a picture at a web address is not loaded, and a password in a URL is not shown.
Which JSONPath does it understand?
All of RFC 9535: names (.name and ['name']), indexes ([0], [-1]), wildcards, .. for every level below, slices ([0:5], [::-1]), lists ([0,2]) and filters ([?@.price < 10 && @.stock]), with length(), count(), value(), match() and search(). A path it can't read gets a message saying where and why.
Can I send someone a link to a value?
Yes, to its path: choose a value and copy Link. The link opens this viewer with that JSONPath typed in and holds only the path, not your data, so the person opening it loads the same file to see the matches. To send the data too, use Share.
Can I change the JSON here?
Yes, in files up to 1 MB. Double-click a value, or choose it and press Enter, to change it in its row (Enter saves, Esc cancels); a number stays a number and text stays text. Double-click a key, or press F2, to rename it. For bigger changes, switch to Text: the JSON opens in an editor at the value you chose, the tree follows each time the text reads as JSON, and a mistake is named by its line.
Can it open JSON from a URL?
No. The page fetches nothing from other sites. Open the URL in your browser or with curl, save the response, and open the file here.
How do I find a value when I don’t know its path?
Type part of the key or value in Find: case is ignored, every match is marked, and Enter goes to the next one (Shift+Enter to the one before). Click the value to get its path.

Related tools