Input:
{
//The input json object
}
Desired Output:
{
"Event1": "Value1",
"Event2": [
// collection of json objects
],
"Event3": {
//The input json object
}
}
So basically the input json goes in the "Event3" of another json object wrapper.
This is my Spec:
[
{
"operation": "shift",
"spec": {
"@": "Event3"
}
},
{
"operation": "default",
"spec": {
"Event1": "Value1",
"Event2": [
// some objects
]
}
}
]
Now the problem is - the above spec is doing the transformation, but ordering of the objects are messed up, like this:
{
"Event3": {
//The input json object
},
"Event2": [
// some objects
],
"Event1": "Value1"
}
Please suggest how should I fix this.
have you tried using the sort operation?
[
{
"operation": "sort",
"spec": {
"*": ""
}
}
]
Think that might do the trick for you ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With