Lets say I have a data structure that looks like this:
{ a: [ 1, 2, 3] }
I want to return 'a' wrapped in an array:
[ [ 1, 2, 3] ]
Is there any way to do this in JSONata?
Intuitively you would try [a]
, which you would expect to return the array as [[1,2,3]]
, but this returns [1,2,3]
, because of array singleton equivalence in JSONata.
You can try the below query
[[a]] - wrapping a within 2 set of square brackets
Since 'a' returns
1, 2, 3
[[a]]
returns
[[1,2,3]]