Input 1:
{"title":"Terminator 2: Judgment Day","year":1991,"stars":[{"name":"Arnold Schwarzenegger"},{"name":"Linda Hamilton"}],"ratings":{"imdb":8.5}}
{"title":"Interstellar","year":2014,"stars":[{"name":"Matthew McConaughey"},{"name":"Anne Hathaway"}],"ratings":{"imdb":8.9}}
Input 2:
{
"title": "Terminator 2: Judgement Day",
"year": 1991,
"stars": [
{
"name": "Arnold Schwarzenegger"
},
{
"name": "Linda Hamilton"
}
],
"ratings": {
"imdb": 8.5
}
}
{
"title": "Interstellar",
"year": 2014,
"stars": [
{
"name": "Matthew McConaughey"
},
{
"name": "Anne Hathaway"
}
],
"ratings": {
"imdb": 8.9
}
}
json2csv -k title,year,ratings.imdb < input1 # works
json2csv -k title,year,ratings.imdb < input2 # FAILS
jsontsv 'title year ratings.imdb' < input1 # works
jsontsv 'title year ratings.imdb' < input2 # works
json2csv -k stars.name < input
""
""
jsontsv 'stars.name' < input
Arnold Schwarzenegger,Linda Hamilton
Matthew McConaughey,Anne Hathaway
jsontsv 'stars[0].name' < input
Arnold Schwarzenegger
Matthew McConaughey