← Back to Docs
  • index.html
  • Clayground
  • Clayground.Text
  • JsonataTransform
  • Clayground 2025.2
  • JsonataTransform QML Type

    JSONata query processor for JSON data transformation. More...

    Import Statement: import Clayground.Text

    Detailed Description

    JsonataTransform provides a way to query and transform JSON data using the JSONata query language. It automatically evaluates the query whenever the input data or query string changes.

    JSONata is a lightweight query and transformation language for JSON data. See https://jsonata.org for the full language specification.

    Example usage:

    import Clayground.Text
    
    JsonataTransform {
        id: stats
        inputObject: {
            "inventory": [
                {"item": "sword", "value": 100},
                {"item": "potion", "value": 20}
            ]
        }
        jsonataString: "$sum(inventory.value)"
    }
    
    Text {
        text: "Total value: " + stats.jsonOutput
    }

    Properties

    The input JSON object to query. Can be any JavaScript object or array.

    The JSONata query expression to evaluate. Examples: "$sum(items.price)", "orders[status='pending']".

    The result of evaluating the JSONata query. Updates automatically when inputObject or jsonataString changes.