Skip to content

Transform JSON

This operation transforms JSON data using JSONata expressions, allowing you to extract, filter, reshape, or create new JSON structures.

POST /api/v1/Json/Transform
NameTypeRequiredDefaultDescription
InputstringYes-Base64-encoded JSON content to transform
TransformationstringYes-JSONata expression to transform the JSON
EncodingstringNo”UTF8”Input encoding. Options: “UTF8”, “ASCII”, “Latin1”, “UTF16”, “BigEndianUnicode”
NameTypeDescription
outputstringTransformed JSON output

The operation uses the JSONata library to transform the provided JSON content. JSONata is a lightweight query and transformation language that provides a concise way to extract, manipulate, and reshape JSON data.

  • Input must be base64 encoded
  • A valid JSONata expression is required
  • The operation returns an empty string if:
    • Input is empty or null
    • Transformation is empty or null
    • Input is not valid base64-encoded data
    • Input cannot be parsed as valid JSON
    • Transformation expression is invalid
    • Transformation execution fails

Input (before base64 encoding):

{
"person": {
"firstName": "John",
"lastName": "Doe",
"age": 42
}
}

Transformation:

person.firstName

Output:

"John"

Input (before base64 encoding):

{
"person": {
"firstName": "John",
"lastName": "Doe",
"age": 42
}
}

Transformation:

person.firstName & " " & person.lastName

Output:

"John Doe"

Input (before base64 encoding):

{
"people": [
{ "name": "John", "age": 42, "active": true },
{ "name": "Jane", "age": 35, "active": false },
{ "name": "Bob", "age": 29, "active": true }
]
}

Transformation:

people[active=true].{
"fullName": name,
"yearsOld": age
}

Output:

[
{ "fullName": "John", "yearsOld": 42 },
{ "fullName": "Bob", "yearsOld": 29 }
]

Credit Cost

Cost: 0.1 credit(s) per operation

Note: Fixed cost per transformation