Home → JSONPath Builder Online

JSONPath Builder Online

Build JSONPath expressions visually and test them against your JSON.

About This Tool

Build JSONPath expressions visually and test them against your JSON. This tool runs entirely in your browser — no data is ever sent to a server. Free to use, no account required.

What JSONPath Builder Does

The JSONPath builder lets you construct and test JSONPath expressions interactively against real JSON data, with instant results.

Point-and-Click Path Building

Click on any value in the JSON tree to automatically generate the JSONPath expression that points to that location. No need to manually write path syntax — click, copy, and use.

Real-Time Expression Testing

As you type or modify a JSONPath expression, the matching values update instantly. This makes it easy to refine your expression iteratively until it returns exactly the values you need.

JSONPath Expression Syntax

Understanding key JSONPath syntax elements lets you write powerful queries for extracting data from complex JSON structures.

Basic Expressions

$ is the root element, . is a child accessor, [] is a subscript operator for arrays and object keys. For example: $.store.book[0].title gets the title of the first book in the store.book array.

Wildcards and Filters

* matches all elements at a level ($.items[*].price gets all prices), [?(@.field operator value)] filters by condition, and .. is the recursive descent operator that searches at any depth (..name finds all name fields anywhere in the document).

Frequently Asked Questions

What is JSONPath?+
JSONPath is a query language for JSON, analogous to XPath for XML. It allows you to extract one or more values from a JSON document using an expression like $.store.book[*].author (all author fields in the book array) or $.items[?(@.price > 100)] (all items where price exceeds 100). JSONPath is used in test frameworks, API gateways, and data transformation tools.
What is the difference between JSONPath and JSON Pointer?+
JSON Pointer (RFC 6901) identifies a single, exact location in a JSON document using slash-separated path segments — it always returns exactly one value. JSONPath is a query language that can match multiple values using wildcards, recursive descent, and filter expressions. Use JSON Pointer for precise single-value references; use JSONPath for flexible queries.
How do I filter a JSON array with JSONPath?+
Use a filter expression in square brackets: [?(@.fieldName operator value)]. For example, $.products[?(@.price < 50)] returns all products where price is less than 50. The @ refers to the current element being tested. You can combine conditions with && and || inside the filter.
Is JSONPath standardized?+
JSONPath originated from a 2007 blog post and was widely adopted without a formal standard for many years, leading to inconsistent implementations. RFC 9535 (published in 2024) is the first official IETF standard for JSONPath, bringing consistency across implementations.

JSONPath Expression Builder Guide

JSONPath is a query language for JSON data, defined in RFC 9535. It lets you extract specific values, filter arrays, and navigate complex nested structures with a single expression.

JSONPath Cheat Sheet

// Given this JSON:
{
  "users": [
    {"id":1, "name":"Alice", "role":"admin", "score":95},
    {"id":2, "name":"Bob",   "role":"user",  "score":82},
    {"id":3, "name":"Carol", "role":"admin", "score":91}
  ],
  "meta": {"total": 3, "page": 1}
}

// Expressions:
$                            // Entire document
$.meta.total                 // 3
$.users[0]                   // First user object
$.users[*].name              // ["Alice","Bob","Carol"]
$.users[-1].name             // "Carol" (last item)
$..name                      // All "name" values anywhere
$.users[?(@.role=="admin")]  // Alice and Carol objects
$.users[?(@.score>90)].name // ["Alice","Carol"]

JSONPath Filter Expressions

ExpressionMeaning
[?(@.key)]Elements where key exists
[?(@.key == value)]Elements where key equals value
[?(@.key != value)]Elements where key differs
[?(@.num > 10)]Elements where num greater than 10
[?(@.num >= 10)]Elements where num >= 10
[?(@.num < 10)]Elements where num less than 10
[?(@.str =~ /regex/)]Elements matching regex (some implementations)

JSONPath in JavaScript

// npm install jsonpath-plus
import { JSONPath } from "jsonpath-plus";

// Basic extraction
const names = JSONPath({path: "$.users[*].name", json: data});

// Filter
const admins = JSONPath({path: "$.users[?(@.role==\"admin\")]", json: data});

// Node.js built-in (no library needed)
const scores = data.users.map(u => u.score); // simpler JS alternative

Building JSONPath Expressions: Common Patterns

Given the following JSON, here are the most frequently needed extraction patterns along with the expressions that produce them.

{
  "users": [
    {"id": 1, "name": "Alice", "role": "admin", "active": true},
    {"id": 2, "name": "Bob",   "role": "user",  "active": false},
    {"id": 3, "name": "Carol", "role": "admin", "active": true}
  ],
  "metadata": {"total": 3, "page": 1}
}
// Common patterns built with the JSONPath Builder:
$.users[*].name              → All user names
$.users[0].name              → First user's name
$.users[-1].id               → Last user's ID
$..id                        → All IDs (any depth)
$.users[?(@.role == 'admin')]        → Admin users
$.users[?(@.active)].name    → Names of active users
$.users[?(@.active == false)].id     → IDs of inactive users
$.metadata.total             → 3
$.users.length               → 3 (some implementations)
$.users[0:2]                 → First 2 users

JSONPath vs JavaScript Array Methods

JSONPath expressions are portable across languages and tools. JavaScript array methods are more familiar to JS developers but require custom recursive functions for deep queries.

Goal JSONPath JavaScript
Get all names$.users[*].nameusers.map(u => u.name)
Filter active$.users[?(@.active)]users.filter(u => u.active)
Find by ID$.users[?(@.id == 2)]users.find(u => u.id === 2)
Any depth key$..emailCustom recursive function
First item$.users[0]users[0]
Last item$.users[-1]users[users.length - 1]

Explore more tools: All JSON Tools | Validator | Pretty Print | JSON Diff