Web Worker · Leaf Index Search

Large JSON Viewer and Leaf-Path Search

Open a local file or paste JSON. When available, a Web Worker parses the complete input and builds a leaf index; the page shows at most 300 matching rows.

Browse All Tools

Test Cases

Four reproducible inspection cases

Load a case to compare the live result with the complete expected leaf list or parse failure. These small cases do not measure large-file performance.

01 / WORKER CASE

Nested API response: paths, zero and false

The five leaves include an array item, numeric zero, false and null. After loading, search ABC or a path substring to narrow the list.

Input

{
  "order": { "id": 7, "items": [{ "sku": "ABC", "qty": 0 }] },
  "ok": false,
  "note": null
}

Expected leaf list or error

$.order.id → 7 (number)
$.order.items[0].sku → ABC (string)
$.order.items[0].qty → 0 (number)
$.ok → false (boolean)
$.note → null (null)

Paths are display text. Objects and arrays are traversed, without expandable parent rows.

02 / WORKER CASE

Restricted TS-style array → three leaves

A static exported array with a type annotation, unquoted keys, single quotes and a trailing comma becomes parsed data. The interface type is not checked.

Input

export const users: User[] = [
  { id: 1, name: 'Ada', active: true, },
];

Expected leaf list or error

$[0].id → 1 (number)
$[0].name → Ada (string)
$[0].active → true (boolean)

Functions, references and general JavaScript programs are not supported; this is a limited conversion, not code execution.

03 / WORKER CASE

Truncated response → visible parse error

The outer object is missing its closing brace. The viewer clears old data, shows a parse error and disables copy/download.

Input

{"order":{"id":7}

Expected leaf list or error

Parse error; no rows or exportable result.

The parser does not repair this input. Exact diagnostic wording comes from the browser parser.

04 / WORKER CASE

Null root → one exportable leaf

A null root is valid JSON. The list contains one null leaf at the root; copying or downloading yields null.

Input

null

Expected leaf list or error

$ → null (null)

Validity is tracked separately from truthiness. Empty objects and arrays instead produce zero leaves.

Concept & Workflow

What Is a Web Worker Large JSON Viewer?

Parsing multi-megabyte JSON payloads or rendering thousands of collapsible DOM nodes on the main thread easily freezes browser tabs. This viewer runs parsing and leaf-index extraction inside a background Web Worker, caps visible rows for smooth scrolling, and lets you search across deep paths or values.

  • Off-main-thread Worker parsing: keeps UI responsive while building a flat leaf index for large inputs.
  • Path & value leaf search: filter deeply nested keys like $.data.items[0].name or scalar values instantaneously.
  • Safe data literal support: accepts standard JSON as well as static JS/TS object/array literals (no code execution).

How to Inspect & Search Large JSON Payloads

  1. 1Load a file or sample: open a local .json/.txt file, paste raw text, or pick one of the 4 cases below.
  2. 2Inspect parse metrics: review file size, parse time in milliseconds, total leaf nodes, and Worker mode.
  3. 3Search by path or value: type any key path fragment or value into the search input to view up to 300 matching rows.
  4. 4Copy or download JSON: export normalized standard JSON once you finish inspecting the payload.

Related examples and guides

Deep Dive

Documentation

Inspect parsed data without rendering every leaf

This viewer shows a flat list of leaf paths, values and types. Search is a case-insensitive substring match across the displayed path and value text. It does not expand a tree or evaluate JSONPath expressions.

Four small, reproducible cases cover nested API data, a restricted TypeScript-style array, truncated input and a null root. The 500-record demo checks row capping; it is not a browser performance benchmark.

Usage Boundaries & Limitations

  • Worker parsing and indexing do not remove memory costs: the source text, parsed data and full leaf index are retained, and results are copied back to the main thread. Search, file reading and JSON export can still affect responsiveness; no fixed MB limit or speed is promised.
  • The list displays up to 300 matches, without expandable nodes or virtual scrolling. Empty objects and arrays have no leaves. Dotted and bracketed keys produce display paths that can be ambiguous; search is text matching, not a JSONPath query engine.
  • Restricted literal conversion does not run pasted code or check TypeScript types. It accepts only part of JavaScript-like syntax and can reject valid data, including some double-quoted strings containing apostrophes when relaxed conversion is needed. Use strict JSON for reliable interchange.
  • Numbers use JSON.parse and JavaScript number precision; large integer identifiers may change. Stringify and clipboard/download export produce the parsed data, rather than preserving original formatting or comments.
  • If Worker is unavailable, parsing and indexing run on the main thread with a visible mode label. Worker startup/runtime errors remain visible and clear the old result. Local processing does not establish a production privacy or browser compatibility guarantee.
Does the Worker guarantee that a large JSON file will not freeze the page?+

No. Parsing and indexing are off-thread when a Worker is available, but data transfer, reactive state, search and export still use the main thread and browser memory. The displayed time covers parsing plus indexing, not complete file reading or UI latency.

Can I expand nodes or run a JSONPath query?+

The current view is a flat leaf list. Search matches path or value text without case sensitivity and trims surrounding spaces. It does not interpret a path expression; special property names can produce ambiguous display paths.

What happens to null, false, zero and empty containers?+

Primitive roots are valid results, including null, false, zero and an empty string. Their single leaf is shown and the parsed value can be exported. Empty arrays and objects have no leaf rows, but remain valid exportable results.

Does downloading export only the first 300 rows?+

No. The cap applies to displayed matches, while copy and download stringify all parsed data. This can use extra memory. Invalid input clears the previous result and disables export until a new parse succeeds.