JSONPath Query API

Extract values from JSON with JSONPath (RFC 9535: wildcards, recursive descent, slices, filters with functions) or JSON Pointer, with the path of each result.

POSTGEThttps://apibox.io.vn/v1/json-query

The JSON query API evaluates a JSONPath expression on a JSON document and returns the matching values with their normalised paths. It implements RFC 9535: member and index selectors ($.store.book[0], $["key with spaces"], negative indexes), wildcards, recursive descent ($..price), slices with steps ([1:5:2], [::-1]), unions ([0,2]) and filters such as $..book[?@.price < 10 && @.category == "fiction"].title.

Filters support existence tests ([?@.isbn]), comparisons of numbers and strings, &&, ||, !, parentheses, references to the root ($) and the functions length(), count(), match() and search() (regular expressions, with the same protection against runaway patterns as the regex API).

Pass pointer=/store/book/1/title instead of path to read one value with a JSON Pointer (RFC 6901). Results are limited to 10,000 values (limit, default 1,000).

Parameters

NameInTypeRequiredDefault
jsonbodyobjectyesThe JSON document (object or JSON string).
pathbody|querystringnoJSONPath expression starting with $.
pointerbody|querystringnoJSON Pointer instead of path, e.g. /a/0.
limitbody|querynumberno1000Maximum number of values returned.

Example

curl -X POST "https://apibox.io.vn/v1/json-query" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":{"store":{"book":[{"title":"Sayings","price":8.95},{"title":"Sword","price":12.99},{"title":"Moby Dick","price":8.99,"isbn":"0-553-21311-3"}]}},"path":"$..book[?@.price < 10].title"}'

Response

{
  "path": "$..book[?@.price < 10].title",
  "count": 2,
  "truncated": false,
  "values": [
    "Sayings",
    "Moby Dick"
  ],
  "paths": [
    "$['store']['book'][0]['title']",
    "$['store']['book'][2]['title']"
  ]
}

Use cases

  • Pick fields from third-party API responses in no-code tools
  • Test JSONPath expressions before using them in code or monitoring
  • Extract values from large JSON exports
  • Teach and debug JSONPath

FAQ

Which JSONPath dialect is this?

RFC 9535, the 2024 IETF standard, which matches the original Goessner syntax for the common cases. The older ?(@.x) filter form with parentheses is accepted too.

What does each result path look like?

Normalised paths such as $['store']['book'][0]['title'], one per value, in the same order.

Can I query with JSON Pointer?

Yes, pointer=/a/0/b returns one value and found=false when it does not exist.

Related APIs

Start with 1,000 free requests every month. Get free API key →