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.nameAccesses the
nameproperty of theUserDetailsobject.Accessing nested properties
plaintextCopy code$.Order.items.productIdAccesses the
productIdproperty 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
firstNameandlastNameproperties of theCustomer.Summing numerical values
plaintextCopy codesum($.Invoice.totalAmount, $.Invoice.tax)Adds the
totalAmountandtaxvalues 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.historyMaps all the grade properties under
StudentDetails.gradesto a corresponding target node.Using a relative path in a filter
plaintextCopy code.grades[subject='math'].scoreAccesses the
scoreproperty for themathsubject 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
Ordersarray to return elements wherestatusisshipped.Accessing a specific index in an array
plaintextCopy code$.Products[2]Accesses the third element (0-based index) in the
Productsarray.
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
Itemsarray wheretypeiselectronicsorappliances.Concatenating a value and its parent
plaintextCopy codeconcat($.Category.name, $.Details.suffix)Combines the
nameproperty of theCategorywith asuffixfromDetails.
Last updated
Was this helpful?
