Open prakashvenkat22 opened 4 years ago
I am trying to convert array of values as comma separated value in jolt, but I am not able get output as comma separated value. Input
{ "errors": [ { "code": 100, "message": [ "msg1", "msg2" ] }, { "code": 101, "message": [ "msg1" ] }, { "code": 102, "message": [ "msg1", "msg2", "msg3" ] } ] }
Jolt Spec I have tried
{ "operation": "modify-overwrite-beta", "spec": { "errors": { "*": { "*": "=concat(@0)" } } } }, { "operation": "shift", "spec": { "errors": { "*": { "code": "errors[].code", "message": "errors[&1].message" } } } } ]
Output as
{ "errors": [ { "code": 100, "message": "msg1msg2" }, { "code": 101, "message": "msg1" }, { "code": 102, "message": "msg1msg2msg3" } ] }
desired output as
{ "errors": [ { "code": 100, "message": "msg1,msg2" }, { "code": 101, "message": "msg1" }, { "code": 102, "message": "msg1,msg2,msg3" } ] }
Hi @prakashvenkat22 You should use join instead of concat. E.g: =join(',',@0)
I am trying to convert array of values as comma separated value in jolt, but I am not able get output as comma separated value. Input
Jolt Spec I have tried
Output as
desired output as