{FormJSON}

JSON Tree Viewer & Explorer

Inspect deeply nested hierarchies, search keys and values in real time, and extract JSONPath locations.

No valid JSON to display.

Navigating & Inspecting Hierarchical JSON Structures

Modern enterprise APIs and microservices frequently return complex, deeply nested JSON responses containing thousands of nodes. Reading raw unformatted text or even indented text with 20+ levels of nesting causes severe cognitive fatigue.

An interactive AST Tree Viewer transforms linear text into an expandable visual hierarchy. This enables engineers to rapidly isolate specific subtrees, collapse unneeded branches, identify data types, and copy precise object paths without manually counting array indices or matching closing braces.

01. High-Density Type Indicators & Node Semantics

FormJson decorates every hierarchical node with high-contrast type badges to enable instant visual scanning:

obj
Object Map
arr
Array List
"str"
String
42
Number
true
Boolean
null
Null Value

02. JSONPath Extraction Syntax & Querying Cheat Sheet

JSONPath (RFC 9535) provides a standardized query expression syntax to pinpoint, filter, and extract nested elements across heterogeneous JSON models:

Operator Description Expression Example Result Match
$ Root object or array $ The entire JSON document
.key or ['key'] Child property selector $.store.book Selects child object 'book'
.. Recursive descent (deep search) $..price Extracts all 'price' keys across all depths
[*] or [0:5] Array wildcard or slice range $.data.items[0:3] First 3 elements in the items array
[?(@.field < val)] Filter predicate expression $..books[?(@.price < 10)] All books with price less than 10

03. Programmatic Tree Traversal & Path Extraction

Building custom tools or automated ETL pipelines requires traversing AST trees to flatten objects or extract specific paths:

Node.js Recursive AST Flattener & Path Collector
// Recursively flatten nested JSON into a dot-notated key-value map
function flattenJsonPaths(obj, prefix = "$") {
  const result = {};

  function traverse(current, currentPath) {
    if (current !== null && typeof current === "object") {
      if (Array.isArray(current)) {
        current.forEach((item, idx) => traverse(item, currentPath + "[" + idx + "]"));
      } else {
        Object.entries(current).forEach(([k, v]) => traverse(v, currentPath + "." + k));
      }
    } else {
      result[currentPath] = current;
    }
  }

  traverse(obj, prefix);
  return result;
}

const payload = { store: { name: "Central", items: [{ id: 101, sku: "A-9" }] } };
console.log(flattenJsonPaths(payload));
Python Deep Key Search Implementation
# Recursively find all values for a target key at any depth
def find_all_keys(data, target_key):
    matches = []
    if isinstance(data, dict):
        for k, v in data.items():
            if k == target_key:
                matches.append(v)
            matches.extend(find_all_keys(v, target_key))
    elif isinstance(data, list):
        for item in data:
            matches.extend(find_all_keys(item, target_key))
    return matches

sample = {"api": {"v1": {"token": "secret_1"}, "v2": [{"token": "secret_2"}]}}
print(find_all_keys(sample, "token")) # ['secret_1', 'secret_2']

FAQ

How does the interactive tree viewer handle large JSON files without lagging?
FormJson utilizes virtualized window rendering and lazy node expansion. Rather than rendering tens of thousands of DOM elements simultaneously, only nodes currently visible inside the viewport are mounted, maintaining smooth 60fps scrolling even on multi-megabyte payloads.
What is JSONPath and how can I extract data using it?
JSONPath is a query expression language for JSON (analogous to XPath for XML). Using expressions like $.users[*].email or $.data.orders[?(@.total > 100)], you can query, slice, and extract targeted values from deeply nested structures without writing custom loop algorithms.
Can I search across both keys and values in the tree view?
Yes. The tree viewer provides real-time recursive filtering. Typing into the search bar traverses the entire AST hierarchy, auto-expanding parent nodes that contain matches and highlighting matching key names, string values, numbers, and boolean states.
How do I copy the exact path of a specific property?
Clicking on any node in the tree inspector provides immediate access to its canonical dot-notation path (e.g. items[3].metadata.id) or standard JSONPath ($.items[3].metadata.id) for instant clipboard copying.
What type badges are displayed in the tree hierarchy?
Every node displays high-contrast visual type indicators, including [obj] for key-value maps with item counts, [arr] for indexed lists, str for strings, num for integers/floats, bool for booleans, and null for null values.
Is my JSON payload transmitted to a remote server for tree generation?
No. The tree AST construction, indexing, and visualization algorithms run 100% locally within your browser client. No data is ever sent to external cloud servers.

Explore Related Tools & Converters

100% Client-Side