CruxDevCruxDev Tools Prompts
dev Utility • Zero-Server Privacy • 100% Client-Side

JSONPath Evaluator

Run JSONPath expressions against JSON data. Visualize matching nodes and arrays instantly.

Overview

Test JSONPath expressions against your own JSON with per-match results: every match is listed with its canonical path and value, plus a total match count. The evaluator covers the core RFC-style operator set — child access, quoted keys, recursive descent, wildcards, negative indices, unions, slices, and filter expressions — as you type, entirely offline.

How It Works

Type an expression such as $.store.books[?(@.price < 10)].title, paste your JSON on the left, and each match appears on the right with its path (like $['store']['books'][2]['title']) and JSON value, under a live match count. Copy values puts the JSON array of matched values on your clipboard. The hint line documents the syntax: $ root, .name children, ..name recursive descent, * wildcards, [0] and [-1] indices, [0,2] unions, [1:5:2] slices, [?(...)] filters with == != < <= > >= =~ comparisons and && / ||, and /regex/ tests.

Step-by-Step Usage Guide

  1. Paste your JSON document into the left editor.
  2. Enter a path — build it up from $ and watch the match count change.
  3. Read the per-match list: each row shows the match's path and value.
  4. Click Copy values to take all matched values as a JSON array.

Technical Specifications & Standards

The evaluator (src/lib/jsonPath.ts) parses the expression into segments and walks the document breadth-first, carrying a canonical bracketed path for every match so results are self-describing and copyable. Filters evaluate @-relative operands against each candidate: @.price < 10 compares numerically, @.isbn alone is an existence check, and @.name =~ /Lord/ applies a regular expression. Slices follow Python semantics including negative bounds and steps. Errors are distinct from empty results: malformed syntax (an unclosed bracket, an unsupported mixed union) produces an explicit parse error naming the position, while a well-formed path that matches nothing reports zero matches — so a typo and an absent field are never confused.

Targeted Use Cases

  • Verifying an accessor path before hardcoding it in application code.
  • Extracting all values matching a condition, such as titles of books under $10, with a filter.
  • Learning JSONPath syntax — recursive descent, slices, and filters — with instant per-match feedback.
  • Pulling one field out of a large response during debugging without reading the whole payload.

Notes & Gotchas

  • Start from $ and build the path one segment at a time; the match count shows exactly where it stops matching.
  • Prefer quoted bracket segments like $['weird key'] when a key contains spaces, dots, or dashes.
  • Remember filters compare @ against literals: @.price < 10 is numeric, @.name =~ /re/ is a regex, and a bare @.prop is an existence test.
  • A zero-match result with no error means the path is valid but matched nothing — check spelling and casing.

Frequently Asked Questions

Does $..price search all levels?

Yes. Recursive descent with two dots walks every nested object and array, collecting matching keys at any depth.

Can I filter arrays by a condition like price below 10?

Yes. Filter expressions such as [?(@.price < 10)] support numeric and string comparisons, == and !=, boolean && and ||, existence checks, and /regex/ matching.

What do I get when the path matches nothing?

An explicit 'no matches' state with the match count showing zero — distinct from a parse error, which names the position where the expression could not be read.

Does the evaluation send my JSON anywhere?

No. Parsing and traversal happen in the page as you type, and the tool works with the network disconnected.