Convert Json Table Arrays To Objects With Jq
Answer : Answering my own question: jq 'to_entries|map(.key) as $keys| (map(.value)|transpose) as $values |$values|map([$keys, .] | transpose| map( {(.[0]): .[1]} ) | add)' Explanation: Extract keys ["IdentifierName", "Code"] and values as [ [ "A", 5 ], [ "B", 8 ], [ "C", 19 ] ] Then to index from keys to values, take json-seq of key-tuple with (each) value tuple and transpose and zip them in pairs. echo '[[ "IdentifierName", "Code" ], [ "C", 19 ] ]'|jq '.|transpose| map( {(.[0]): .[1]} ) | add' Combining both gives solution. This will work for any number of elements (0 and 1 are just key and value, not first and second). $ jq '[.IdentifierName, .Code] | transpose | map( { "IdentifierName": .[0], "Code": .[1] } ) ' file.json [ { "IdentifierName": "A", "Code": 5 }, { "IdentifierN...