Open ketulpatel03 opened 1 year ago
You can use this spec:
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"class *": {
"*": {
"Detail *": {
"*": {
"*": { // PAN
"*": { // 0, 1
"*": {
"#PAN": "&9.&8 &3.&1.&1",
"#detail index": "&9.&8 &3.&1.detail &(5,1)",
"#class index": "&9.&8 &3.&1.class &(7,1)"
}
}
}
}
}
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"*": {
"* *": {
"$": "&4.&3[&2].@(1)"
},
"*": {
"$": "&4.&3[&2].@(1)"
}
}
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": "=recursivelySquashNulls"
}
}
]
Input : { "Report": { "level 10": { "class 1": { "Message": "demo message", "Details": { "Detail 1": { "IDENTIFICATION": { "PAN": [ "1" ] } }, "Detail 2": { "IDENTIFICATION": { "PAN": [ "2", "3" ] } }, "Detail 3": { "IDENTIFICATION": { "PAN": [ "4" ] } } } }, "class 2": { "Message": "Demo message", "Details": { "Detail 1": { "IDENTIFICATION": { "PAN": [ "5" ] } }, "Detail 2": { "IDENTIFICATION": { "PAN": [ "6", "7" ] } }, "Detail 3": { "IDENTIFICATION": { "PAN": [ "8" ] } } } } } } }
Expected Output : { "Report": { "level 10 PAN": [ { "class index": "class 1", "detail index": "detail 1", "PAN": "1" }, { "class index": "class 1", "detail index": "detail 2", "PAN": "2" }, { "class index": "class 1", "detail index": "detail 2", "PAN": "3" }, { "class index": "class 1", "detail index": "detail 3", "PAN": "4" }, { "class index": "class 2", "detail index": "detail 1", "PAN": "5" }, { "class index": "class 2", "detail index": "detail 2", "PAN": "6" }, { "class index": "class 2", "detail index": "detail 2", "PAN": "7" }, { "class index": "class 2", "detail index": "detail 3", "PAN": "8" } ] } }