Skip to main content

Response selection

body is an ordinary payload column now. If you've used the old WHERE body = 'path' syntax, here's how to pull out nested values instead.

Use PATH on a column to read a nested value. If that value is an array and you want a row for each element, keep it as JSON text and expand it with json_each:

CREATE VIRTUAL TABLE bundles USING vttp (
URL ('https://r4.smarthealthit.org/Patient'),
entries TEXT PATH '$.entry'
);
SELECT e.value ->> '$.resource.id' AS id
FROM bundles, json_each(bundles.entries) AS e;

The Bundle is one response object, so bundles has one row. json_each walks its entries array and gives us a row for each entry. From there, we can query the resource fields with SQLite's usual JSON operators.

See JSON mapping for supported paths and response shapes.