If you have a csv dataset like this:
name, age, genderjohn, 20, malejane, 30, femalebob, 25, male
Can you get to this:
[ {"name": "john", "age": 20, "gender": "male"}, {"name": "jane", "age": 30, "gender": "female"}, {"name": "bob", "age": 25, "gender": "male"} ]
using only jq?
I found this article which shows what I'm trying to do, but it uses a 'manual' mapping of the header fields to the values. I don't need/want to rename the header fields and have quite a few of them. I would also not want to have to change a script/command every time the layout changes.
Is it possible to dynamically extract the headers and then combine them with the values with a jq one-liner?