With jq you could run something along the lines of:
- (Assuming you want to select just some fields) create a jq filter "x.jq"
["name","id","f3""tenant","f4"]"vpc"] , ### the csv header
(.peerings[] ## ### for all in peerings list
| [ .name,
.id,
(.accept_vpc_info | [ .tenant_id,
.vpc_id ])
].accept_vpc_info.vpc_id
|flatten
) ]
) | @csv
- run it!
$ jq -rf x.jq ex.json
"name","id","f1""tenant","f2""vpc"
"NAME1","0b19d","184a5","0d11f"
"NAME2","0d34a","067eb","17944"
"NAME3","173e2","0ae21","071c4"