Is there any way to store it using javascript? I'm creating a website which on clicking a button generates and updates a csv file with the json response data from the above
Asked
Active
Viewed 31 times
-1
-
1Have you tried anything yet? Perhaps even searching on Google? I found this: https://stackoverflow.com/questions/8847766/how-to-convert-json-to-csv-format-and-store-in-a-variable#8924856 – Phiter Feb 27 '18 at 18:28
-
yes i have i've tried the code youve mentioned too but since it's a nested json repsonse , it doesnt work very well. Therfore i asked this question to know the best way to do this – Glen Feb 28 '18 at 19:02
1 Answers
0
JSON allows nested structures, whereas CSV is flat. Therefore, you can't save JSON as CSV unless:
- you can guarantee that your JSON will never have nested elements
- you can pre-define how nested elements should be flattened
- you wish to store chunks of JSON as single columns in the CSV file (serialization)

bendodge
- 470
- 5
- 12