Closed ysmimaa closed 2 years ago
Hello
I have some issue finding the right way to filter in my input json file using jolt as described in the following:
{ "test1": 2242, "test2": 23456, "description": "desc, desc, desc", "name1": "foo", "active": true, "date1": "xx-xx-xx", "date2": "xx-xx-xx", "grade": "A", "quantity": 10, "information": "info, info, info", "favorite": "Y", "maxValue": 100, "approachTypeMin[zone=MAR, method=a]": "12", "approachTypeMax[zone=MAR, method=a]": "50", "approachTypeMin[zone=NOR, method=b]": "3", "approachTypeMax[zone=NOR, method=b]": "10" }
This is my Spec
[ { "operation": "shift", "spec": { "test1": "value1", "test2": "value2", "description": "desc1", "name1": "nameValue", "active": { "true": { "#Active": "status" }, "false": { "#Inactive": "status" } }, "date1": "beginDate", "date2": "endDate", "grade": { "*": { "$": "testGrade.value", "@(2,type)": "testGrade.type", "#2": "testGrade.defaultValue" } }, "quantity": "qtn", "additionalInfo": "information", "favorite": "fvt", "maxValue": "max", "approachType*, method=*]": "test.&(0,2)" } } ]
This is my actual Output { "value1" : 2242, "value2" : 23456, "desc1" : "desc, desc, desc", "nameValue" : "foo", "status" : "Active", "beginDate" : "xx-xx-xx", "endDate" : "xx-xx-xx", "testGrade" : { "value" : "A", "defaultValue" : "2" }, "qtn" : 10, "fvt" : "Y", "max" : 100, "test" : { "A" : [ "12", "50" ], "B" : [ "3", "10" ] } }
My issue is that i can't find a way to get something like the result above depending on the grade(e.g grade A==Approach method):
{ "value1": 2242, "value2": 23456, "desc1": "desc, desc, desc", "nameValue": "foo", "status": "Active", "beginDate": "xx-xx-xx", "endDate": "xx-xx-xx", "value": "X", "testGrade": { "type": "A", "defaultValue": "2" }, "qtn": "10", "fvt": "Y", "max": "100", "convertedApproachMin": 12, "convertedApproachMax": 50 }
Thanks for any help!
Fixed by @Barbaros https://stackoverflow.com/questions/71819470/filter-values-depends-on-another-field
Hello
I have some issue finding the right way to filter in my input json file using jolt as described in the following:
This is my Spec
My issue is that i can't find a way to get something like the result above depending on the grade(e.g grade A==Approach method):
Thanks for any help!