Skip to content

Jolt

Reshape, rename, and validate JSON documents with declarative Bazaarvoice Jolt specs

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/jolt/index.md to help me query Jolt with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Reshape nested JSON

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]');
Result
jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]')
{"Rating":3}

Quick start

Choose where to run Jolt, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

ATTACH 'jolt' AS jolt (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-jolt:0.5.0'
);

3. Run a query

query.sql
SELECT jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]');
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

ATTACH 'jolt' AS jolt (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-jolt:0.5.0'
);

Overview

Declarative JSON->JSON structural transformation via Bazaarvoice Jolt

Catalog

Everything jolt exposes once attached — read straight from the worker's released build.

jolt 1 schema
main 5 functions

Declarative JSON->JSON transformation and validation functions.

Schema examples (8)
Examples (8)

Apply a full chainr spec to lift a deeply nested rating value up to a top-level Rating key.

SELECT jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]');
Result
jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]')
{"Rating":3}

Rename and nest flat keys into a name object with a single shift operation.

SELECT jolt.main.jolt_shift('{"first":"Ada","last":"Lovelace"}', '{"first":"name.given","last":"name.family"}');

Supply default values for keys absent from the input document.

SELECT jolt.main.jolt_default('{"name":"widget"}', '{"inStock":true,"currency":"USD"}');

Guard a pipeline by checking that a string is a well-formed Jolt chainr spec before transforming.

SELECT jolt.main.is_valid_jolt_spec('[{"operation":"shift","spec":{"a":"b"}}]');
4 more examples

Check that a payload is well-formed JSON before reshaping it.

SELECT jolt.main.json_valid('{"a":[1,2,3]}');

Skip malformed payloads with json_valid, then reshape the well-formed ones with jolt_shift: row 2 is truncated JSON and is filtered out, rows 1 and 3 become {"device":...,"celsius":...} documents.

SELECT raw.id,
  jolt.main.jolt_shift(raw.payload, '{"dev":"device","reading":{"c":"celsius"}}') AS normalized
FROM (VALUES (1, '{"dev":"t-1","reading":{"c":21.5}}'), (2, '{"dev":"t-2","reading":'), (3, '{"dev":"t-3","reading":{"c":19.0}}')) AS raw(id, payload)
WHERE jolt.main.json_valid(raw.payload)
ORDER BY raw.id;

Normalize nested order payloads with jolt_shift, fill the missing currency with jolt_default (USD), then total revenue per currency: EUR has 2 orders summing 40.5 and the two currency-less orders roll up as USD 49.5.

WITH orders(payload) AS (VALUES ('{"order":{"id":101,"total":{"amount":25.0,"currency":"EUR"}}}'), ('{"order":{"id":102,"total":{"amount":40.0}}}'), ('{"order":{"id":103,"total":{"amount":15.5,"currency":"EUR"}}}'), ('{"order":{"id":104,"total":{"amount":9.5}}}')), canonical AS (SELECT jolt.main.jolt_default(jolt.main.jolt_shift(orders.payload, '{"order":{"id":"order_id","total":{"amount":"amount","currency":"currency"}}}'), '{"currency":"USD"}') AS doc FROM orders) SELECT json_extract_string(canonical.doc, '$.currency') AS currency, count(*) AS order_count, sum(CAST(json_extract_string(canonical.doc, '$.amount') AS DOUBLE)) AS revenue
FROM canonical
GROUP BY currency
ORDER BY currency;

Preflight a registry of mappings before deploying them: json_valid checks each sample payload and is_valid_jolt_spec checks each chainr spec. orders_v2 misspells the shift operation (spec_ok false) and sensors_v1 has a trailing comma in its sample (sample_ok false).

SELECT m.mapping, jolt.main.json_valid(m.sample_doc) AS sample_ok,
  jolt.main.is_valid_jolt_spec(m.spec) AS spec_ok
FROM (VALUES ('orders_v1', '{"order":{"id":1}}', '[{"operation":"shift","spec":{"order":{"id":"order_id"}}}]'), ('orders_v2', '{"order":{"id":2}}', '[{"operation":"shfit","spec":{"order":{"id":"order_id"}}}]'), ('sensors_v1', '{"dev":"t-1",}', '[{"operation":"default","spec":{"unit":"C"}}]')) AS m(mapping, sample_doc, spec)
ORDER BY m.mapping;
Scalar functions
is_valid_jolt_spec (spec_json ANY) 2 examples

True when the input parses and compiles as a Bazaarvoice Jolt chainr spec (a JSON array of operations).

Arguments
spec_json ANY
The candidate Jolt chainr spec to validate (one value per row, given either as JSON text or as raw JSON bytes). Returns true when it both parses as JSON and compiles via Chainr.fromSpec; false for malformed JSON, a non-array, or an unknown operation. A NULL row yields a NULL result and validation never raises an error.
ReturnsBOOLEAN
Examples (2)

Returns true: the input parses and compiles as a Jolt chainr spec. An unknown operation or malformed JSON returns false instead of erroring.

SELECT jolt.main.is_valid_jolt_spec('[{"operation":"shift","spec":{"a":"b"}}]');

Preflight a registry of mappings before deploying them: json_valid checks each sample payload and is_valid_jolt_spec checks each chainr spec. orders_v2 misspells the shift operation (spec_ok false) and sensors_v1 has a trailing comma in its sample (sample_ok false).

SELECT m.mapping, jolt.main.json_valid(m.sample_doc) AS sample_ok,
  jolt.main.is_valid_jolt_spec(m.spec) AS spec_ok
FROM (VALUES ('orders_v1', '{"order":{"id":1}}', '[{"operation":"shift","spec":{"order":{"id":"order_id"}}}]'), ('orders_v2', '{"order":{"id":2}}', '[{"operation":"shfit","spec":{"order":{"id":"order_id"}}}]'), ('sensors_v1', '{"dev":"t-1",}', '[{"operation":"default","spec":{"unit":"C"}}]')) AS m(mapping, sample_doc, spec)
ORDER BY m.mapping;
Link
jolt_default (input_json ANY, default_spec VARCHAR) 2 examples

Apply a single Jolt 'default' operation (supply default values for keys absent from the input); default_spec is the bare default spec object. Returns JSON.

Arguments
input_json ANY
The JSON document to enrich (one value per row, given either as JSON text or as raw JSON bytes). This is the data column; the default spec fills in keys absent from each row's document. A NULL row yields a NULL result; malformed JSON raises an error.
default_spec VARCHAR
A constant bare Jolt default specification (NOT wrapped in the chainr operation envelope): a tree of keys/values supplied only where the input is missing them; existing keys are left untouched. Compiled once per batch; an invalid spec raises an error.
ReturnsVARCHAR
Examples (2)

Apply a bare Jolt default spec to fill in inStock and currency keys that are absent from the input document.

SELECT jolt.main.jolt_default('{"name":"widget"}', '{"inStock":true,"currency":"USD"}');

Normalize nested order payloads with jolt_shift, fill the missing currency with jolt_default (USD), then total revenue per currency: EUR has 2 orders summing 40.5 and the two currency-less orders roll up as USD 49.5.

WITH orders(payload) AS (VALUES ('{"order":{"id":101,"total":{"amount":25.0,"currency":"EUR"}}}'), ('{"order":{"id":102,"total":{"amount":40.0}}}'), ('{"order":{"id":103,"total":{"amount":15.5,"currency":"EUR"}}}'), ('{"order":{"id":104,"total":{"amount":9.5}}}')), canonical AS (SELECT jolt.main.jolt_default(jolt.main.jolt_shift(orders.payload, '{"order":{"id":"order_id","total":{"amount":"amount","currency":"currency"}}}'), '{"currency":"USD"}') AS doc FROM orders) SELECT json_extract_string(canonical.doc, '$.currency') AS currency, count(*) AS order_count, sum(CAST(json_extract_string(canonical.doc, '$.amount') AS DOUBLE)) AS revenue
FROM canonical
GROUP BY currency
ORDER BY currency;
Link
jolt_shift (input_json ANY, shift_spec VARCHAR) 8 examples

Apply a single Jolt 'shift' operation (path-based copy/move of input values into an output tree); shift_spec is the bare shift spec object. Returns JSON.

Arguments
input_json ANY
The JSON document to reshape (one value per row, given either as JSON text or as raw JSON bytes). This is the data column; the shift spec is applied to each row's document. A NULL row yields a NULL result; malformed JSON raises an error.
shift_spec VARCHAR
A constant bare Jolt shift specification (NOT wrapped in the {"operation":"shift",...} chainr envelope): a tree mirroring the input where each leaf is the output path Jolt copies the matched input value to. Compiled once per batch; an invalid spec raises an error.
ReturnsVARCHAR
Examples (8)

Apply a bare Jolt shift spec to rename and nest flat input keys into a name object with given/family.

SELECT jolt.main.jolt_shift('{"first":"Ada","last":"Lovelace"}', '{"first":"name.given","last":"name.family"}');

Skip malformed payloads with json_valid, then reshape the well-formed ones with jolt_shift: row 2 is truncated JSON and is filtered out, rows 1 and 3 become {"device":...,"celsius":...} documents.

SELECT raw.id,
  jolt.main.jolt_shift(raw.payload, '{"dev":"device","reading":{"c":"celsius"}}') AS normalized
FROM (VALUES (1, '{"dev":"t-1","reading":{"c":21.5}}'), (2, '{"dev":"t-2","reading":'), (3, '{"dev":"t-3","reading":{"c":19.0}}')) AS raw(id, payload)
WHERE jolt.main.json_valid(raw.payload)
ORDER BY raw.id;
SELECT jolt.main.jolt_shift('{"first":"Ada","last":"Lovelace"}', '{"first":"name.given","last":"name.family"}') AS out;
5 more examples
SELECT jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]') AS out;
SELECT jolt.main.jolt_default('{"name":"widget"}', '{"inStock":true,"currency":"USD"}') AS out;
SELECT jolt.main.is_valid_jolt_spec('[{"operation":"shift","spec":{"a":"b"}}]') AS ok;
SELECT jolt.main.json_valid('{"a":[1,2,3]}') AS ok;
SELECT m.mapping, jolt.main.json_valid(m.sample_doc) AS sample_ok,
  jolt.main.is_valid_jolt_spec(m.spec) AS spec_ok
FROM (VALUES ('orders_v1', '{"order":{"id":1}}', '[{"operation":"shift","spec":{"order":{"id":"order_id"}}}]'), ('orders_v2', '{"order":{"id":2}}', '[{"operation":"shfit","spec":{"order":{"id":"order_id"}}}]'), ('sensors_v1', '{"dev":"t-1",}', '[{"operation":"default","spec":{"unit":"C"}}]')) AS m(mapping, sample_doc, spec)
ORDER BY m.mapping;
Link
jolt_transform (input_json ANY, spec_json VARCHAR) 1 example

Apply a full Bazaarvoice Jolt spec (a JSON array of shift/default/remove/cardinality/sort/modify operations) to an input JSON document; returns the transformed JSON string.

Arguments
input_json ANY
The JSON document to transform (one value per row, given either as JSON text or as raw JSON bytes). This is the data column; the Jolt spec is applied to each row's document. A NULL row yields a NULL result; malformed JSON raises an error.
spec_json VARCHAR
A constant Jolt chainr specification: a JSON array of operation entries, each {"operation": <name>, "spec": <op-spec>} (e.g. shift, default, remove, cardinality, sort, modify-*-beta), applied in order. Compiled once per batch and reused for every input row; a malformed or invalid spec raises an error.
ReturnsVARCHAR
Example

Apply a full Jolt chainr spec (a single shift operation) to lift a deeply nested value up to a top-level Rating key.

SELECT jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]');
Result
jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]')
{"Rating":3}
Link
json_valid (input_json ANY) 3 examples

True when the input parses as a well-formed JSON document.

Arguments
input_json ANY
The candidate JSON document to validate (one value per row, given either as JSON text or as raw JSON bytes). Returns true when it parses as well-formed JSON via the Jolt JSON reader, false otherwise. A NULL row yields a NULL result and validation never raises an error.
ReturnsBOOLEAN
Examples (3)

Returns true: the input is a well-formed JSON document. Malformed JSON returns false instead of erroring.

SELECT jolt.main.json_valid('{"a":[1,2,3]}');

Skip malformed payloads with json_valid, then reshape the well-formed ones with jolt_shift: row 2 is truncated JSON and is filtered out, rows 1 and 3 become {"device":...,"celsius":...} documents.

SELECT raw.id,
  jolt.main.jolt_shift(raw.payload, '{"dev":"device","reading":{"c":"celsius"}}') AS normalized
FROM (VALUES (1, '{"dev":"t-1","reading":{"c":21.5}}'), (2, '{"dev":"t-2","reading":'), (3, '{"dev":"t-3","reading":{"c":19.0}}')) AS raw(id, payload)
WHERE jolt.main.json_valid(raw.payload)
ORDER BY raw.id;

Preflight a registry of mappings before deploying them: json_valid checks each sample payload and is_valid_jolt_spec checks each chainr spec. orders_v2 misspells the shift operation (spec_ok false) and sensors_v1 has a trailing comma in its sample (sample_ok false).

SELECT m.mapping, jolt.main.json_valid(m.sample_doc) AS sample_ok,
  jolt.main.is_valid_jolt_spec(m.spec) AS spec_ok
FROM (VALUES ('orders_v1', '{"order":{"id":1}}', '[{"operation":"shift","spec":{"order":{"id":"order_id"}}}]'), ('orders_v2', '{"order":{"id":2}}', '[{"operation":"shfit","spec":{"order":{"id":"order_id"}}}]'), ('sensors_v1', '{"dev":"t-1",}', '[{"operation":"default","spec":{"unit":"C"}}]')) AS m(mapping, sample_doc, spec)
ORDER BY m.mapping;
Link

Try these queries

Rename and nest flat keys into a name object with a single shift operation.

SELECT jolt.main.jolt_shift('{"first":"Ada","last":"Lovelace"}', '{"first":"name.given","last":"name.family"}');

Uses jolt_shift

Supply default values for keys absent from the input document.

SELECT jolt.main.jolt_default('{"name":"widget"}', '{"inStock":true,"currency":"USD"}');

Uses jolt_default

Guard a pipeline by checking that a string is a well-formed Jolt chainr spec before transforming.

SELECT jolt.main.is_valid_jolt_spec('[{"operation":"shift","spec":{"a":"b"}}]');

Uses is_valid_jolt_spec

Check that a payload is well-formed JSON before reshaping it.

SELECT jolt.main.json_valid('{"a":[1,2,3]}');

Uses json_valid

Skip malformed payloads with json_valid, then reshape the well-formed ones with jolt_shift: row 2 is truncated JSON and is filtered out, rows 1 and 3 become {"device":...,"celsius":...} documents.

SELECT raw.id,
  jolt.main.jolt_shift(raw.payload, '{"dev":"device","reading":{"c":"celsius"}}') AS normalized
FROM (VALUES (1, '{"dev":"t-1","reading":{"c":21.5}}'), (2, '{"dev":"t-2","reading":'), (3, '{"dev":"t-3","reading":{"c":19.0}}')) AS raw(id, payload)
WHERE jolt.main.json_valid(raw.payload)
ORDER BY raw.id;

Uses jolt_shiftjson_valid

Lift a deeply nested value to the top level with a full chainr spec.

SELECT jolt.main.jolt_transform('{"rating":{"primary":{"value":3}}}', '[{"operation":"shift","spec":{"rating":{"primary":{"value":"Rating"}}}}]') AS out;

Uses jolt_transform

6 more examples in the Catalog, each listed under the table or function it uses.

Jolt is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.