Demo

Sample JSON data:

{{myJSONData | json}}

Converted CSV Output:

{{myCSVData}}

Usage

Step 1: Download the "parsebuddy.js" file and include it via the script tag.

<script src="pathto/parsebuddy.js"></script>

Step 2: Call parseBuddy.jsonToCsv() function from your js code and pass in the json object.

jsonToCsv() takes two parameter:

1. inputData (required) - which is the JSON object,

2. delimiter (optional) - the delimiter you want in your CSV data. Default is , (comma)

var myJSONData = [{a: 1, b: 2, c: 3, d:4}, {a: 11, b: 22, c: 33, d:44}, {a: 111, b: 222, c: 333, d:444}];
var myCSVData = parseBuddy.jsonToCsv(myJSONData);

Output:

a,b,c,d
1,2,3,4
11,22,33,44
111,222,333,444