Skip to content

Replace JSONata4Java with dashjoin/jsonata-java#69

Merged
fdelbrayelle merged 1 commit intomainfrom
plugin-transform/issues/40
Mar 26, 2026
Merged

Replace JSONata4Java with dashjoin/jsonata-java#69
fdelbrayelle merged 1 commit intomainfrom
plugin-transform/issues/40

Conversation

@fdelbrayelle
Copy link
Copy Markdown
Member

Summary

Fixes #40

Test plan

  • All existing TransformValueTest tests pass
  • All existing TransformItemsTest tests pass
  • New shouldHandleNestedArrayExpressionFromIssue40 test validates the exact example from the issue produces correctly nested arrays (not flattened)

…atibility

JSONata4Java is not a complete implementation of the JSONata spec, causing
expressions that work on try.jsonata.org to fail in Kestra (e.g. nested array
path expressions). Switch to dashjoin/jsonata-java which is a 1:1 port of the
JavaScript reference implementation with 100% feature parity.

Fixes #40
@github-project-automation github-project-automation Bot moved this to To review in Pull Requests Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 25, 2026

📦 Artifacts

Name Size Updated Expiration
jar 2.96 MB Mar 25, 26, 5:19:20 PM UTC Apr 1, 26, 5:19:20 PM UTC

🧪 Java Unit Tests

TestsPassed ✅Skipped ⚠️FailedTime ⏱
Java Tests Report136 ran135 ✅1 ⚠️0 ❌44s 836ms

🔁 Unreleased Commits

✅ No unreleased commits found.

@fdelbrayelle fdelbrayelle self-assigned this Mar 25, 2026
@fdelbrayelle
Copy link
Copy Markdown
Member Author

🧪 QA Report — Replace JSONata4Java with dashjoin/jsonata-java

Branch: plugin-transform/issues/40
Kestra: OSS v1.3.5 (Docker, server local mode)
Plugin version: 1.3.4-SNAPSHOT

Summary

# Flow Task(s) Type Result
1 jsonata_transform_value TransformValue Non-regression (plugin example) ✅ SUCCESS
2 jsonata_transform_items TransformItems (string concat + sum) Non-regression (plugin example) ✅ SUCCESS
3 jsonata_transform_items_orders TransformItems (order total calc) Non-regression (plugin example) ✅ SUCCESS
4 jsonata_issue40_nested_path TransformValue New — Issue #40 repro ✅ SUCCESS

Flow 1: jsonata_transform_value (✅ SUCCESS)

Flow YAML
id: jsonata_transform_value
namespace: qa.test
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\": 1.50}, {\"product_id\": \"002\", \"name\": \"Banana\", \"quantity\": 3, \"price\": 0.75}]}"
    expression: "{\"order_id\": order_id, \"full_name\": first_name & \" \" & last_name, \"city\": address.city, \"total_items\": $sum(items.quantity), \"total_price\": $sum(items.(quantity * price))}"

Logs synthesis
Task transform_json completed in 0.54s with status SUCCESS.

Outputs synthesis
Output correctly contains: order_id: "ABC123", full_name: "John Doe", city: "Paris", total_items: 8, total_price: 9.75. All values match expected JSONata transformation results.


Flow 2: jsonata_transform_items (✅ SUCCESS)

Flow YAML
id: jsonata_transform_items
namespace: qa.test
tasks:
  - id: http_download
    type: io.kestra.plugin.core.http.Download
    uri: https://dummyjson.com/products

  - id: get_product_and_brand_name
    description: "String Transformation"
    type: io.kestra.plugin.transform.jsonata.TransformItems
    from: "{{ outputs.http_download.uri }}"
    expression: "products.(title & ' by ' & brand)"

  - id: get_total_price
    description: "Number Transformation"
    type: io.kestra.plugin.transform.jsonata.TransformItems
    from: "{{ outputs.http_download.uri }}"
    expression: "$sum(products.price)"

Logs synthesis
All 3 tasks completed with SUCCESS status. No errors or warnings.

Outputs synthesis

  • http_download: downloaded 43.1 KiB (HTTP 200) from dummyjson.com
  • get_product_and_brand_name: produced output URI with 2 items (string concat results)
  • get_total_price: produced output URI with 2 items (sum result)

Flow 3: jsonata_transform_items_orders (✅ SUCCESS)

Flow YAML
id: jsonata_transform_items_orders
namespace: qa.test
tasks:
  - id: extract
    type: io.kestra.plugin.core.http.Download
    uri: https://huggingface.co/datasets/kestra/datasets/resolve/main/json/orders.json

  - id: jsonata
    type: io.kestra.plugin.transform.jsonata.TransformItems
    from: "{{ outputs.extract.uri }}"
    expression: |
      Account.Order.{
        "order_id": OrderID,
        "total": $round($sum(Product.(Price * Quantity)), 2)
      }

Logs synthesis
Both tasks completed with SUCCESS status. No errors or warnings.

Outputs synthesis

  • extract: downloaded 4.1 KiB (HTTP 200) from HuggingFace
  • jsonata: produced output URI with 2 items (order_id + total per order). Uses $round, $sum, nested path access, and object construction — all working correctly.

Flow 4: jsonata_issue40_nested_path (✅ SUCCESS) — Issue #40 Reproduction

Flow YAML
id: jsonata_issue40_nested_path
namespace: qa.test
description: "Reproduces issue #40 - nested path expression that was broken with JSONata4Java"
tasks:
  - id: transform_nested
    type: io.kestra.plugin.transform.jsonata.TransformValue
    from: |
      {
        "filterTuples": [
          {
            "filter": [
              {"parent": {"parent": {"hybrisId": "8796977876513"}, "hybrisId": "8796995440161"}, "hybrisId": "8796998946337"},
              {"parent": {"parent": {"hybrisId": "8796977876513"}, "hybrisId": "8796995472929"}, "hybrisId": "8797002583585"},
              {"parent": {"parent": {"hybrisId": "8796977843745"}, "hybrisId": "8796995341857"}, "hybrisId": "8796999798305"}
            ]
          },
          {
            "filter": [
              {"parent": {"parent": {"hybrisId": "8796977876513"}, "hybrisId": "8796995440161"}, "hybrisId": "8796998946337"},
              {"parent": {"parent": {"hybrisId": "8796977876513"}, "hybrisId": "8796995472929"}, "hybrisId": "8797002583585"},
              {"parent": {"parent": {"hybrisId": "8796977843745"}, "hybrisId": "8796995341857"}, "hybrisId": "8796999765537"}
            ]
          }
        ]
      }
    expression: "[filterTuples.[filter.(parent.parent.hybrisId & \"/\" & parent.hybrisId & \"/\" & hybrisId)]]"

Logs synthesis
Task transform_nested completed with SUCCESS status.

Outputs synthesis
Output matches the expected result from issue #40 exactly:

[
  [
    "8796977876513/8796995440161/8796998946337",
    "8796977876513/8796995472929/8797002583585",
    "8796977843745/8796995341857/8796999798305"
  ],
  [
    "8796977876513/8796995440161/8796998946337",
    "8796977876513/8796995472929/8797002583585",
    "8796977843745/8796995341857/8796999765537"
  ]
]

With the old JSONata4Java, this returned a flat array (6 elements). With dashjoin/jsonata-java, it correctly returns two nested arrays (matching try.jsonata.org behavior).


Timeout notes

No timeouts encountered. All executions completed within a few seconds.

@fdelbrayelle fdelbrayelle merged commit 7466384 into main Mar 26, 2026
6 checks passed
@fdelbrayelle fdelbrayelle deleted the plugin-transform/issues/40 branch March 26, 2026 14:08
@github-project-automation github-project-automation Bot moved this from To review to Done in Pull Requests Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

consider changing JSONata Java implementation to overcome feature limitations of JSONata4Java

2 participants