Reputation: 31
I have the input like below,
Input:
{
"a": 1,
"b": 2
}
Spec:
[
{
"operation": "shift",
"spec": {
"a": {
"@(2,b)": {
"#Matched": "result"
},
"*": {
"#Not Matched": "result"
}
}
}
}]
Output:
{
"result" : [ "Matched", "Not Matched" ]
}
Expected:
{
"result" : "Not Matched"
}
Can anyone please suggest me help to work it as usual.
Upvotes: 1
Views: 1524
Reputation: 31
You can transform it in three steps:
(can't imagine why it doesn't work with values)
Smth like:
[
{
"operation": "shift",
"spec": {
"*": "&.@0"
}
},
{
"operation": "shift",
"spec": {
"a": {
"*": {
"@(2,b.&)": {
"#Matched": "result"
}
}
}
}
},
{
"operation": "default",
"spec": {
"result": "Not Matched"
}
}
]
Upvotes: 1