4

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

4
  • Use a library to parse JSON files (GSON and Jackson are the most well-known), then use a FileWriter to write your CSV. Commented Jan 21, 2015 at 12:38
  • 1
    Apache POI and JExcel can help you. Commented Jan 21, 2015 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. Commented Jan 21, 2015 at 12:39
  • @slartidan can you give me any example. Because I don't know PHP Commented Jan 21, 2015 at 13:16

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

3 Comments

I am getting compliletime error at this line JSONArray docs = response.getJSONArray("infile"); asking me to create local variable.
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?
Hi @pelumi, it seems as of 2023 December, above external link is not available anymore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.