Ingest
Handling JSON mapping
This section covers JSON path as a wya to map JSON fields to schema
Syntax
- JSONPath expressions start with
$
, which refers to the root of the JSON document - Dots
.
indicate traversal to a child property - Brackets
[]
can access elements in arrays
Example
Given the following data structure:
This is the corresponding YAML configuration:
Top-Level Fields: Fields like product_id
and event
are mapped directly since they are at the root of the JSON structure
Nested Fields: JSONPath is used to extract data from deeper levels of the JSON object:
$.extra_data.city
maps to thecity
column.$.extra_data.discount.amount
maps to thediscount_amount
column.
In Airfold UI
To map JSON just use Source
creation wizard as usual.
Example:
Choose Text
to create schema from a text sample.
Paste your JSON object into the wizard.
Check out the resulting schema.
Rename columns if needed.
Add name to the source and click Create
to create the source.
You can remove lines from YAML to remove field mappings you are not interested in.
You can add new mappings too.