Wednesday, 12 April 2017

How to convert JSon array to csv?

I have an array of JSon as follows:

 [
  {
   city: "c1"
   spots: ["s1","s2"]
   tags:  ["t1","t2"]
  },
  {
   city: "c2"
   spots: ["s3","s2"]
   tags:  ["t1","t2","t4"]
  },
  ....
  ....
 ]

I try to convert it and save to csv file by using "json2csv" module. But the problem is i have two fields, "spots" and "tags", are array. It seems with "json2csv", unwindpath option only specify 1 column, not multiple columns.

Is there any module I could use for this task?



via alim

No comments:

Post a Comment