I am getting a data that is based on the amount of results can either be an array of objects or a single object like below.
{ << when i have only one result I am getting this
"foo": "x",
"bar": "y"
}
[ << when i have more then one result i am getting an array of objects
{
"foo": "x0",
"bar": "y0"
},
{
"foo": "x1",
"bar": "y2"
},
]
On each cases as a result I want an array of object(s) like below
[
{
"foo": "x",
"bar": "y"
},
...
]
I want to be able to apply cardinality to the root, if its a single object turn it into "MANY" and if its already an array do nothing. I can't find a way where I can apply cardinality to root object. right now what I am doing is this;
Where I am first moving the object to a key ("data") apply cardinality and then move the result back to the root. Which works, but I dont think is the correct way of doing it.
I am getting a data that is based on the amount of results can either be an array of objects or a single object like below.
On each cases as a result I want an array of object(s) like below
I want to be able to apply
cardinality
to the root, if its a single object turn it into "MANY" and if its already an array do nothing. I can't find a way where I can apply cardinality to root object. right now what I am doing is this;Where I am first moving the object to a key ("data") apply cardinality and then move the result back to the root. Which works, but I dont think is the correct way of doing it.