I\'m trying to parse environment variables from the JSON output of docker inspect. Annoyingly, those environment variables aren\'t returned as useful key-value
Given collection of items to convert to a single object, I generally would opt to using reduce for this purpose. Turn those items to their constituent keys and values, then assign to the result object.
reduce (.[] | split("=")) as [$key, $value] ({}; .[$key] = $value)
Though using from_entries is also useful here as well, instead you'd create an array of the key/value objects that it expects.
map(split("=") as [$key, $value] | {$key, $value}) | from_entries
Then put it all together with the update of the Env property using whichever method you choose.
.[].Config.Env |= reduce (.[] | split("=")) as [$key, $value] ({}; .[$key] = $value)
#or
.[].Config.Env |= (map(split("=") as [$key, $value] | {$key, $value}) | from_entries)
https://jqplay.org/s/qfItW5U-Tf