title: Converting JSON to CSV via cli
body: <p>I am using an API to get data from NetFlow Analyzer. I get a JSON file formatted like this;</p>
  
  <pre><code>{"startTime":"2017-12-29 11:58","resultVector":[{"port":"*","app":"Unknown_App","dscpCode":"0","traffic":"4.77 MB","dscp":"Default","src":"20.xx.xx.2","dst":"10.xx.xx.1","dstport":"*","prot":"Unknown"}],"Type":"DestinationIN","devDetails":{"deviceID":"5000006","Total":"4.77 MB"},"TimeZone":"America/Chicago","endTime":"2018-01-05 11:58"}
  </code></pre>
  
  <p>I have been trying to use json2csv (<a href="https://github.com/jehiah/json2csv" rel="nofollow noreferrer">https://github.com/jehiah/json2csv</a>) found at github, and did have success using for a different API &amp; JSON output format. When I run </p>
  
  <pre><code>json2csv -k port,app,dscpCode,traffic,dscp,src,dst,dstport,prot -i filein.json -o fileout2.csv
  </code></pre>
  
  <p>I get a csv file with nothing but ",,,,,". What I am trying to get are the traffic, source IP, and destination IP.</p>
  
  <p>Running;
      json2csv -k startTime,resultVector -i filein.json -o fileout2.csv
  Gives me this output which while close, it not csv really</p>
  
  <pre><code>2017-12-29 11:58,[map[dscpCode:0 src:20.xx.xx.2 dst:10.xx.xx.1 prot:Unknown port:* app:Unknown_App dstport:* traffic:4.77 MB dscp:Default]]
  </code></pre>
  
  <p>Checked few online sites that report this is a valid RFC 4627 JSON. Anyone else familiar with json2csv, or if nothing else another cli tool for Linux that I can use in a script to convert?</p>