Does anyone have a slick way of converting an array where each element is an array of length 2, that contains the key at index 0 and value at index 1, into a JSON object. This is what the original looks like:
{
"HeadersIn": [
[
"Host",
"example.com"
],
[
"Accept",
"*/*"
],
[
"Connection",
"keep-alive"
],
[
"Cookie",
""
],
[
"User-Agent",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12"
],
[
"Accept-Language",
"en-us"
],
[
"Referer",
"https://example.com/"
],
[
"Accept-Encoding",
"gzip, deflate"
]
]
}
Output should be
{
"HeadersIn": {
"Host": "example.com",
"Accept": "*/*",
"Connection": "keep-alive",
"Cookie": "",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12",
"Accept-Language": "en-us",
"Referer": "https://example.com/",
"Accept-Encoding": "gzip, deflate"
}
}