Mapping Types and Usage
The platform supports various mapping techniques to facilitate efficient data transformation and extraction from JSON schemas. The supported types include Simple Path Access, Functions with Arguments, Relative Mapping, Filters, and Combined Expressions.
1. Simple Path Access
Access specific properties within the JSON schema using absolute paths.
Examples
Accessing a property
plaintextCopy code$.UserDetails.name
Accesses the
name
property of theUserDetails
object.Accessing nested properties
plaintextCopy code$.Order.items.productId
Accesses the
productId
property of an object withinOrder.items
.
2. Functions with Arguments
Perform operations like concatenation, summation, or finding the maximum value using built-in functions.
Examples
Concatenation of strings
plaintextCopy codeconcat($.Customer.firstName, $.Customer.lastName)
Combines the
firstName
andlastName
properties of theCustomer
.Summing numerical values
plaintextCopy codesum($.Invoice.totalAmount, $.Invoice.tax)
Adds the
totalAmount
andtax
values of theInvoice
.Finding the maximum value
plaintextCopy codemax($.Grades.math, $.Grades.science, $.Grades.english)
Finds the maximum score among
math
,science
, andenglish
.
3. Relative Mapping
Map children of an object using relative paths.
Examples
Mapping nested properties
plaintextCopy code$.StudentDetails .grades.math .grades.english .grades.history
Maps all the grade properties under
StudentDetails.grades
to a corresponding target node.Using a relative path in a filter
plaintextCopy code.grades[subject='math'].score
Accesses the
score
property for themath
subject from a relative node.
4. Filters
Use filters to conditionally select values or index arrays.
Examples
Selecting array elements by condition
plaintextCopy code$.Orders[status='shipped']
Filters the
Orders
array to return elements wherestatus
isshipped
.Accessing a specific index in an array
plaintextCopy code$.Products[2]
Accesses the third element (0-based index) in the
Products
array.
5. Combined Expressions
Combine multiple mapping features into a single expression for complex transformations.
Examples
Math with a filter condition
plaintextCopy codesum($.Items[.type='electronics'].price, $.Items[.type='appliances'].price)
Calculates the total price of items in the
Items
array wheretype
iselectronics
orappliances
.Concatenating a value and its parent
plaintextCopy codeconcat($.Category.name, $.Details.suffix)
Combines the
name
property of theCategory
with asuffix
fromDetails
.
Last updated
Was this helpful?