You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @mikhail-barg, we noticed an interesting discrepancy in the behavior of the $append function.
According to the documentation regarding singleton arrays when a single item is returned the result will be that single value rather than an array. However if a '[]' is used in the expression then we get an array with a single item.
hi @huangshu91, thanks for reporting this! I've recently found there seem to be a problem with array constructors in my implementation, that causes some corner cases to behave not in accord with original jsonata-js
For example the behavior addressed here is not yet implemented. The thing you reported seem to have a similar source.
I've made a first attempt to address this issue, but the problem seem to be more deep than I've expected, and fixing it will probably require a lot of careful tunings. So I'll need some time to muster enough courage to make a second attempt.
Hi @mikhail-barg, we noticed an interesting discrepancy in the behavior of the $append function.
According to the documentation regarding singleton arrays when a single item is returned the result will be that single value rather than an array. However if a '[]' is used in the expression then we get an array with a single item.
https://docs.jsonata.org/predicate#singleton-array-and-value-equivalence
For example if we look at the try jsonata playground:
https://try.jsonata.org/OmF3X21ZQ
$ ~> | $ | {"test": ([] ~> $append(test))}|
For this simple transform query we get:
{ "test": [ { "test": "test" } ] }
However it seems when we run this same query through the c# implementation we get this:
{"test": { "test": "test"}}
We've worked around this but it seems to be a bug?
The text was updated successfully, but these errors were encountered: