Closed marcioandrada closed 7 months ago
The functions are expected to be JSONata expressions, not JavaScript. As this is a Java implementation we have no JavaScript parser available to interpret JavaScript function declarations. However, using parentheses etc, you can create pretty complicated expressions in JSONata.
Hi, @wnm3 ,
Thank you for the quick reply!! I will give it ia try. My problem is actually to make a conversion of Timezones in timestamps, because JSONata works with static timezone offsets in the format, like "+0100", "+0200", etc... But we would like to be able to set the offset depending on the local time being variable, i.e., being in Daylight Saving Time or not. I would be able to achieve this using Javascript.
in that case, would you know, by any chance, how I could achieve this transformation for dynamic timezone offset using JSONata, please?
Thank you! Márcio
Hi, @wnm3 ,
Never mind, I am closing this issue. I finally found a way to create a JSONata function to return the offset based on the actual Timezone name.
Thanks for the tips, anyway!
Kind regards, Márcio Andrada
Good morning, @wnm3,
I have been trying to use the Expression.registerFunction() method. It seems to accept and parse correctly simple functions, but if I try to define a full JavaScript function the Expressions.parser step fails from within the Binding class call.
Is it expected that we are able to register and execute full JavaScript functions, or does this only work with simple 1-line functions? I am trying with version 2.4.5.
Thank you, Márcio Andrada
Originally posted by @marcioandrada in https://github.com/IBM/JSONata4Java/issues/13#issuecomment-1813947134