Snipget.ai

Extract a value from JSON by path

Exact
json_path

Deterministic and authoritative — the canonical answer for this input.

Extract a value from a JSON document by dotted path (users.0.email). Numeric segments index into arrays. Returns found=False when the path doesn't resolve, distinct from a path that resolves to null — a confident negative (the document was walked, the path is definitively absent), so confidence stays 1.0 either way. Processing multiple inputs? Use `json_path_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

The JSON document to extract from.

pathstringrequired

Dotted path, e.g. 'users.0.email'.

separatorstringoptional

Path separator.

Call it

curl -X POST https://api.snipget.ai/v1/json/path \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"{\"users\": [{\"email\": \"[email protected]\"}]}","path":"users.0.email"}'

The Batch tab sends up to 1000 inputs in one call via /v1/json/path/batch.

Example response

{
  "input": "{\"users\": [{\"email\": \"[email protected]\"}]}",
  "is_valid": true,
  "path": "users.0.email",
  "found": true,
  "value": "[email protected]",
  "value_type": "string"
}

FAQ

What does this save me?

It pulls one value out of a nested JSON document without you hand-walking the structure. You give a simple dotted path like users.0.email and get the value back, deterministically every time.

How do I point at an item in a list?

Use the number for its position, starting at 0. So users.0.email is the email of the first user, users.1.email the second. Negative numbers count from the end.

What happens when the path is not there?

It returns found set to false with a null value, rather than an error. That lets you tell apart a path that is missing from a path that really holds a JSON null. Confidence stays 1.0 on a miss: the document was fully walked, so 'not there' is a confident answer, not uncertainty.

Does it support full JSONPath with filters and wildcards?

No. It is intentionally simple dotted paths with numeric list indexes. Filters, wildcards, and recursive search are not supported. For those you would post-process the result yourself.

How is this different from Flatten?

Path fetches one value at a known location. Flatten turns the whole document into a flat list of every path and value at once, which is better when you want to see everything.

Related tools