Open pradeepcheers opened 3 years ago
I tried this with the current code and it seemed to work using the dataobject_9.json that I'll check in today. You can test this with the Tester application by passing the filename as an argument:
Ensure you are using the latest version: https://search.maven.org/artifact/com.ibm.jsonata4java/JSONata4Java/1.5.8/jar
Attempting to load JSON from file: dataobject_9.json
Using json:
{
"subscriptions" : [ {
"entitlementIds" : [ "30a2aad62" ]
} ]
}
Enter jsonata expression (or q to quit):
subscriptions.entitlements != null
false
Enter jsonata expression (or q to quit):
subscriptions.entitlementIds != null
true
Enter jsonata expression (or q to quit):
{ "ProductEntitlements": subscriptions.entitlementIds != null ? [ $map(subscriptions.entitlementIds, function($string) { { "EntitlementId" : $string } })] : [] }
{
"ProductEntitlements" : [ {
"EntitlementId" : "30a2aad62"
} ]
}
There seem like a bug in the $map function. when I try to run this expression (https://try.jsonata.org/vga_ZLC4c) on jsonata console it works fine but not in Jsonata4Java library.