TransformValue TransformValue

yaml
type: "io.kestra.plugin.transform.jsonata.TransformValue"

Transform or query a JSON data using JSONata.

JSONata is a query and transformation language for JSON data.

Examples

Transform JSON data using a JSONata expression

yaml
id: jsonata_transform_value
namespace: company.team

tasks:
  - id: transform_json
    type: io.kestra.plugin.transform.jsonata.TransformValue
    from: |
      {
        "order_id": "ABC123",
        "first_name": "John",
        "last_name": "Doe",
        "address": {
          "city": "Paris",
          "country": "France"
        },
        "items": [
          {
            "product_id": "001",
            "name": "Apple",
            "quantity": 5,
            "price_per_unit": 0.5
          },
          {
            "product_id": "002",
            "name": "Banana",
            "quantity": 3,
            "price_per_unit": 0.3
          },
          {
            "product_id": "003",
            "name": "Orange",
            "quantity": 2,
            "price_per_unit": 0.4
          }
        ]
      }
    expression: |
      {
        "order_id": order_id,
        "customer_name": first_name & ' ' & last_name,
        "address": address.city & ', ' & address.country,
        "total_price": $sum(items.(quantity * price_per_unit))
      }

Properties

expression

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The JSONata expression to apply on the JSON object.

from

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The value to be transformed.

Must be a valid JSON string.

maxDepth

  • Type: integer
  • Dynamic: ✔️
  • Required: ✔️
  • Default: 1000

The maximum number of recursive calls allowed for the JSONata transformation.

Outputs

value

  • Type: object
  • Required:

The transformed value.

Was this page helpful?