Skip to content

Instantly share code, notes, and snippets.

@maxwindiff
Created January 28, 2020 07:20
Show Gist options
  • Save maxwindiff/6eff975a14386fe4dcafdc91f1304400 to your computer and use it in GitHub Desktop.
Save maxwindiff/6eff975a14386fe4dcafdc91f1304400 to your computer and use it in GitHub Desktop.
$ jq '.[] | . as $parent | .cities[] | $parent.provinceName + "," + .cityName + "," + (.confirmedCount | tostring)'
[
{
"provinceName": "Guangdong",
"cities": [
{
"cityName": "Guangzhou",
"confirmedCount": 10
},
{
"cityName": "Shenzhen",
"confirmedCount": 20
}
]
},
{
"provinceName": "Hubei",
"cities": [
{
"cityName": "Wuhan",
"confirmedCount": 30
}
]
}
]
"Guangdong,Guangzhou,10"
"Guangdong,Shenzhen,20"
"Hubei,Wuhan,30"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment