Connectors / Core / JSON Transformer

Transform JSON using the JSONata query & transformation language (updated: 1658224932724)

JSON Transformer

JSON Transformer transforms JSON using the JSONata query language

Overview

The main purpose of the JSON Transformer is to transform JSON data using the JSONata query language.

Please see the JSONata docs for a query language reference

Operations List

  • Transform

Example usage

Using the following JSON data object which represents some books in a library and the customers who have borrowed specific books.

{
"library": {
"books": [
{
"title": "Structure and Interpretation of Computer Programs",
"authors": [
"Abelson",
"Sussman"
],
"isbn": "9780262510875",
"price": 38.9,
"copies": 2
},
{
"title": "The C Programming Language",
"authors": [
"Kernighan",
"Richie"
],
"isbn": "9780131103627",
"price": 33.59,
"copies": 3
},
{
"title": "The AWK Programming Language",
"authors": [
"Aho",
"Kernighan",
"Weinberger"
],
"isbn": "9780201079814",
"copies": 1
},
{
"title": "Compilers: Principles, Techniques, and Tools",
"authors": [
"Aho",
"Lam",
"Sethi",
"Ullman"
],
"isbn": "9780201100884",
"price": 23.38,
"copies": 1
}
],
"loans": [
{
"customer": "10001",
"isbn": "9780262510875",
"return": "2016-12-05"
},
{
"customer": "10003",
"isbn": "9780201100884",
"return": "2016-10-22"
},
{
"customer": "10003",
"isbn": "9780262510875",
"return": "2016-12-22"
}
],
"customers": [
{
"id": "10001",
"name": "Joe Doe",
"address": {
"street": "2 Long Road",
"city": "Winchester",
"postcode": "SO22 5PU"
}
},
{
"id": "10002",
"name": "Fred Bloggs",
"address": {
"street": "56 Letsby Avenue",
"city": "Winchester",
"postcode": "SO22 4WD"
}
},
{
"id": "10003",
"name": "Jason Arthur",
"address": {
"street": "1 Preddy Gate",
"city": "Southampton",
"postcode": "SO14 0MG"
}
}
]
}
}

The following JSONata query would transform into a single array of customer names, book titles and due dates

library.loans@$L.books@$B[$L.isbn=$B.isbn].customers[$L.customer=id].{
'customer': name,
'book': $B.title,
'due': $L.return
}

resulting in the following response JSON

[
{
"customer": "Joe Doe",
"book": "Structure and Interpretation of Computer Programs",
"due": "2016-12-05"
},
{
"customer": "Jason Arthur",
"book": "Compilers: Principles, Techniques, and Tools",
"due": "2016-10-22"
},
{
"customer": "Jason Arthur",
"book": "Structure and Interpretation of Computer Programs",
"due": "2016-12-22"
}
]

All Operations

Latest version:

1.0

Transform JSON

Transform some JSON using JSONata.