JSON Viewer and Editor

Paste JSON or open a file to browse it as a collapsible tree. Search it, copy the path to any value, and edit keys and values in place. Your data stays on your device.

    Everything runs in your browser. Pasted text and opened files are read on your device and never uploaded, and they are not saved in the page address.

    How to use the JSON viewer

    1. Paste JSON into the JSON input box, click Open file to pick a .json file, or drop a file on the box. Load sample fills it with example data.
    2. Browse the tree. Click the arrow next to an object or array, or use Expand all, Collapse all or Expand to depth. With the tree focused, the arrow keys move between nodes and open or close them.
    3. Type in the search box to highlight matching keys and values. Press Next or Previous (or Enter and Shift+Enter) to jump between matches; hidden matches are expanded for you.
    4. Click a node to see its path as JSONPath and as JavaScript, then copy either one, or copy the value itself.
    5. Edit the selected node: rename its key, change its value or type, delete it, or add a child to an object or array. Undo reverses the last edit.
    6. Click Copy JSON or Download to take the edited JSON with you, indented the way you chose under Output.

    What the JSON viewer does

    A JSON viewer turns a block of JSON text into a tree you can open one level at a time, so you can find your way around an API response or a config file without reading every line. This one is also a JSON editor: you can change the data in the tree and copy or download the result.

    To indent, minify or validate JSON as text, or to see why a document fails to parse, use the JSON formatter. This viewer shows the same line and column for syntax errors. To compare two documents, use the JSON diff tool.

    How paths are written

    Every node has a path from the root. The viewer writes it two ways:

    KeyJSONPathJavaScript
    name$.namedata.name
    Array item 0$[0]data[0]
    post-code$["post-code"]data["post-code"]
    first name$["first name"]data["first name"]
    $id$["$id"]data.$id
    2024 (a key, not an index)$["2024"]data["2024"]

    JSONPath, standardized in RFC 9535, starts at $. The short .name form is only allowed when the name starts with an ASCII letter, underscore or any non-ASCII character, and continues with those or digits; anything else goes in brackets as a quoted string. In JavaScript, dot access works for any valid identifier, which includes names containing $, and bracket access with a string works for every key. The viewer uses data as the variable name, so replace it with your own. The viewer puts every key that is not a plain ASCII name in brackets, which is valid in both notations. A key containing a lone surrogate (half of an emoji or other character outside the Basic Multilingual Plane) cannot be written in JSONPath at all, so the viewer says so and gives only the JavaScript path.

    How editing works

    Each edit builds a new copy of the data with one change, then writes the whole document back into the input box: indented if your input was indented, minified if it was all on one line. The old copy is kept so Undo can restore it, up to the last 50 edits. Because the input box is rewritten, the text there always matches the tree, and the stats update after every change. Because the document is rebuilt from the parsed data, the first edit applies JavaScript's parsing rules to the whole file: integers above 9,007,199,254,740,991 are rounded, only the last of any duplicate keys is kept, keys that are array indexes such as "2" move to the front of their object, and numbers are rewritten in their shortest form, so 1.0 becomes 1 and 1e3 becomes 1000.

    When you change a value, the type list decides how your text is read. A string is taken exactly as typed, without surrounding quotes. A number must follow JSON's number rules, so 1e3 and -0.5 work but .5, +1 and 1,000 do not. A boolean is true or false, and an object or array is entered as JSON, such as {"a": 1}. Renaming a key keeps it in the same position, unless the old or new name is an array index such as "2", which JavaScript always moves to the front.

    Large files

    The tree only creates page elements for nodes you can see. A collapsed object costs nothing to display however much it contains, and a large array shows its first 200 items with a button to show 200 more. Expand all stops at about 3,000 visible rows and says so, so a file of several megabytes stays usable. Search and stats still cover the whole document.

    Opened files are read with the browser's FileReader and parsed with JSON.parse. Nothing is sent to a server. Your JSON and search text are never put in the page address or saved; only options such as the output indent are remembered.

    Worked example

    Click Load sample. The input holds a small bookshop record with 31 lines, and the stats read object, 17 keys, depth 4, 451 bytes. The key count includes keys in nested objects, and depth 4 is the path down to a tag such as "sci-fi": root, books, the first book, its tags array, then the tag.

    Search for sci: there is 1 match, and Next opens the tree to $.books[0].tags[0]. Click the post-code key under address and the paths read $.address["post-code"] and data.address["post-code"], because a hyphen is not allowed in the short form.

    Now make four edits: rename post-code to postcode, set the second book's year to the number 1816, add the string classic to its tags array, and delete manager. The second book becomes {"title":"Emma","year":1816,"tags":["romance","classic"]}, and the stats read 16 keys, depth 4, 450 bytes.

    Common mistakes

    Key terms

    JSON
    JavaScript Object Notation, a text format for structured data defined in RFC 8259. It has objects of key/value pairs, arrays, double-quoted strings, numbers, true, false and null. It is the most common format for web APIs and many configuration files.
    JSONPath
    A notation for pointing to a location inside a JSON document, starting with $ for the root, then .key for object members and [n] for array items, as in $.users[0].email. Standardized as RFC 9535, it also supports queries and wildcards.
    Tree view
    A display that shows nested data as an outline of nodes that can be expanded and collapsed. Each object or array is a branch and each string, number, boolean or null is a leaf.
    Node
    One value in a JSON tree: an object, an array or a single value, together with the key or index that leads to it from its parent. The root node is the whole document.
    Nesting depth
    How many levels of objects and arrays you pass through to reach the deepest value, counting from the root. In {"a": [1]} the number 1 is at depth 2.
    Bracket notation
    Accessing a property by writing its name as a quoted string in square brackets, as in data["first name"]. It works for any key, including ones with spaces, hyphens or a leading digit, which dot notation cannot express.

    Frequently asked questions

    How do I view a JSON file?
    Click Open file and choose the file, or drop it on the input box. It is read in your browser and shown as a tree with the first two levels open. You can also paste the text straight in.
    Can I edit JSON here?
    You can rename keys, change values and their types, delete nodes and add keys or array items. Each change is written back to the input box, Undo reverses it, and Copy JSON or Download gives you the result.
    How do I get the path to a value?
    Click the value in the tree. The panel shows its JSONPath, such as $.books[0].title, and the JavaScript expression that reads it, such as data.books[0].title, each with a copy button.
    Why does a key appear in brackets in the path?
    Keys with spaces, hyphens, a leading digit or other symbols cannot use the short dot form, so they are written as a quoted string in brackets, such as $["first name"].
    Can it open large JSON files?
    Files of several megabytes work, limited mainly by your device's memory, though very large files take longer to parse and search.
    Is my data uploaded?
    No. Parsing, searching and editing all run in your browser, and opened files are read locally. The JSON is not put in the page address or saved between visits.
    Does search look inside collapsed nodes?
    It does. The match count covers the whole document, and Next or Previous expands the nodes that lead to each match so you can see it.
    How do I move through the tree with the keyboard?
    Tab into the tree, then use Up and Down to move, Right to open a node or step into it, Left to close it or go to its parent, and Home or End to jump to the first or last visible node. Enter or Space opens and closes the current node.