Creating dynamic response using xPath

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

Hi,

I have a JSON integration service in which I get different values for a key. I want to use those Values as Keys in my response output.

Sample Backend Response:

{ "main": { "inner1": { "inner2": [ { "key": "keyValue1", "key2": { "inner3": { "key3": { "count": 1 }, "key4": { "count": 0 }, } } }, { "key": "keyValue2", "key2": { "inner3": { "key3": { "count": 0 }, "key4": { "count": 1 }, } } }, ] } } }

Required Output:

{ "inner2" : { "keyValue1": { "key3": 1, "key4": 0}, "keyValue2": { "key3": 0, "key4": 1} } }

Is there any way to achieve it using xPath in the integration service?

Thanks and Regards,