Skip to content

Filter playground

The Filter playground runs a JSONPath, jq or XPath expression on a document you paste and shows the result as you type. Use it to work out an expression before you use it in the response filter, a load test capture or an agent’s send_request, or to pull data out of JSON copied from somewhere else. Open it from the Tools sidebar.

  1. Pick the language: JSONPath, jq or XPath.
  2. Paste the document on the left (JSON, or XML or HTML for XPath), or click From history to use the body of a response you sent from Zorvik.
  3. Type an Expression, or click one of the examples under it (Try:) to start from.

The Result shows what matches, with the number of matches next to the expression and a copy button. A mistake shows what is wrong in red, for example Not a valid jq expression: expected a closing bracket, or The text isn’t valid JSON (…).

LanguageRunsShows
JSONPath (RFC 9535)In Rust, exactly like the response filterThe matches as a JSON array
jqIn Rust, exactly like the response filterEach result on its own, like the jq command
XPath 1.0In the app’s web viewNodes as markup, numbers, strings and booleans as text. Text that starts with <!doctype html or <html is read as HTML (leniently); other text must be well-formed XML.

At most 10,000 results are shown, as in the response filter.

LanguageExpressionGives
JSONPath$..idEvery id, at any depth
JSONPath$.items[-1]The last item
JSONPath$.items[?@.price > 10].nameNames of items that cost more than 10
JSONPath$.items[?length(@.tags) > 0]Items with at least one tag
jq.items | lengthThe number of items
jq.items | map({id, name})Each item with only id and name
jq[.items[].price] | addThe sum of the prices
XPathcount(//item)The number of item elements
XPath//*[@id]Every element with an id attribute