I want to process JSON data using jq. Here is an excerpt from the data:
{
"lat": "49.3877286",
"lon": "6.704062",
"tag": [
{
"k": "name",
"v": "Beckingen"
},
{
"k": "is_in",
"v": "Merzig-Wadern,Saarland,Bundesrepublik Deutschland,Europe"
},
{
"k": "place",
"v": "town"
},
]
}
{
"lat": "49.287307",
"lon": "6.8827786",
"tag": [
{
"k": "name",
"v": "Püttlingen"
},
{
"k": "place",
"v": "town"
},
{
"k": "population",
"v": "18748"
}
]
}
I need to extract the lat, lon, and name fields, like this:
{
"lat": "49.3877286",
"lon": "6.704062",
"name": "Beckingen"
},
{
"lat": "49.287307",
"lon": "6.8827786",
"name": "Püttlingen"
}
I'm almost there, but I can't figure out how to select a field from an array using select(). Can anyone point me in the right direction?
Many thanks,
Enno