zemirco / json2csv

Convert json to csv with column titles
http://zemirco.github.io/json2csv
MIT License
2.72k stars 363 forks source link

Be able to select a specific field from JSON object input as input array #209

Closed anlexN closed 6 years ago

anlexN commented 7 years ago

i have test.json:

{
  "contributors": [
    {
      "name": "TJ Holowaychuk",
      "email": "tj@vision-media.ca"
    },
    {
      "name": "Aaron Heckmann",
      "email": "aaron.heckmann+github@gmail.com"
    },
    {
      "name": "Ciaran Jessup",
      "email": "ciaranj@gmail.com"
    },
    {
      "name": "Douglas Christopher Wilson",
      "email": "doug@somethingdoug.com"
    },
    {
      "name": "Guillermo Rauch",
      "email": "rauchg@gmail.com"
    },
    {
      "name": "Jonathan Ong",
      "email": "me@jongleberry.com"
    },
    {
      "name": "Roman Shtylman",
      "email": "shtylman+expressjs@gmail.com"
    },
    {
      "name": "Young Jae Sim",
      "email": "hanul@hanul.me"
    }
  ]
}

i want to make a csv like this:

name, email
 "TJ Holowaychuk", "tj@vision-media.ca"
"Aaron Heckmann", "aaron.heckmann+github@gmail.com"

because i want to import my contacts to gmail !

Otherwise, i want to ask how to export repo contributors' name and email? default

juanjoDiaz commented 6 years ago

I think that getting specific fields of a JSON is out of json2CSV scope. I'd suggest that you use some JSON parser like jQ or similar to get the array and then pass it to json2csv

juanjoDiaz commented 6 years ago

Closing this issue since it seems stale (no activity for a long while) Feel free to reopen.