Help with embedded JSON flatten - Ruby Filter

HI All

I have been struggling with this json structure for some time now. Im looking for assistance in flattening this json message. I assume that ruby iteration would be needed here but all the examples I try dont seem to work for me. The data comes from IBM API COnnect event export as a json document.

Here is some data. It should be noted that number of items in the embedded jsons are dynamic. Id like to flatten the response_http_headers in this example.

{
"api_name": "app",
"status_code": "200 OK",
"request_method": "GET",
"developer_org_name": "dev",
"http_user_agent": "Healthcheck",
"resource_path": "get",
"@version": "1",
"response_http_headers": [
{
"Content-Type": "application/json"
},
{
"Date": "Mon, 19 Nov 2018 15:49:21 GMT"
},
{
"X-Global-Transaction-ID": "4538538753"
},
{
"User-Agent": "IBM-APIConnect/5.0"
},
{
"accept": "application/json"
},
{
"Via": "1.1 AQAAACbdihddsQb8-"
},
{
"X-Client-IP": "107.1.22.4"
},
{
"Access-Control-Expose-Headers": "APIm-Debug-Trans-Id, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Global-Transaction-ID"
},
{
"Access-Control-Allow-Origin": "*"
},
{
"Access-Control-Allow-Methods": "GET"
},
{
"Access-Control-Allow-Credentials": "false"
}
],
"org_name": "org"
}

Thanks

utilized this script from Chris Lyons

found this topic - Ruby filter for parsing deeply nested JSON in pipeline

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.