I am developing an application where I need to export JSON Data to excel sheet. I searched in google . But I didn't get any good tutorial. can you suggest me any tutorial. this is my exact requirement. But I need the same in Java
Asked
Active
Viewed 5.2k times
4
-
Use a library to parse JSON files (GSON and Jackson are the most well-known), then use a `FileWriter` to write your CSV. – NiziL Jan 21 '15 at 12:38
-
1Apache POI and JExcel can help you. – Tomasz Waszczyk Jan 21 '15 at 12:39
-
You could try to get the PHP source code and manually transform it into java syntax. If the PHP script is short, than this will not be so much of an affort. – slartidan Jan 21 '15 at 12:39
-
@slartidan can you give me any example. Because I don't know PHP – chitti Jan 21 '15 at 13:16
1 Answers
7
Questions on exporting JSON to CSV have been previously asked here and a response was provided here: Converting JSON to XLS/CSV in Java
However since you asked for a tutorial this page shows an example with a different approach.
Hope that helps
-
I am getting compliletime error at this line JSONArray docs = response.getJSONArray("infile"); asking me to create local variable. – chitti Jan 21 '15 at 13:07
-
Since I can't see your full code, I'm not sure which local variable you're referring to but it seems like the variable 'response' is the problem... Where did you declare it? – pelumi Jan 21 '15 at 13:11