Free plan

JSON / XML query

Pull chosen values out of a data file by giving their path
POST
/v1/data/path-query

About this tool

JSON and XML files store data in nested layers. A path is a short line of text, such as $.items[*].price, that points to the values you want. This tool follows your path and collects all matching values into a table. You can use several paths and filters, such as prices over 10.
For example, you list every product name from a large JSON file.

How to use it

  1. Choose this tool.
  2. Add your JSON, XML, YAML, TOML or table file with Upload or drag and drop.
  3. Type the path that points to the values you want.
  4. Set how many results to keep if needed, then press Generate.
  5. Download the matches.

What you get back

You get a table of the values that matched your path. Download it.
GOOD TO KNOW
No code is evaluated: the path language is read by the service. A table file is searched as a list of row objects. A query matching more than 200,000 values is refused. Counts as one conversion.
TEST IT LIVE

Try JSON / XML query in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Data
Plan
Free
Method
POST
Endpoint
/v1/data/path-query
Tool ID
data.path-query
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Data
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/data/path-query" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'query=$..price' \
  -F 'queries=["$..title","$..price"]' \
  -F 'mode=all'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.data.pathQuery({
    "file": 'document.pdf',
    "query": "$..price",
    "queries": "[\"$..title\",\"$..price\"]",
    "mode": "all"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->data()->pathQuery([
    'file' => 'document.pdf',
    'query' => '$..price',
    'queries' => '["$..title","$..price"]',
    'mode' => 'all',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Run JSONPath queries on a JSON, YAML, TOML, XML or table file ($.items[*].price, $..name, filters such as [?(@.price > 10 && @.tags contains 'sale')], slices, unions) and get the matches as a table, with the first ones inline.

JSON / XML query works from text and settings, so no file is needed. Every input is optional.

JSON / XML query is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/data/path-query with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.