XML (or JSON) to CSV

XML (or JSON) to CSV
0

#1

Hi all,

I am stuck and could use some help! I am making an API call (using JAVA) that returns XML data. I need the XML data to be stored into a Microsoft Excel file. I’ve converted the XML data into JSON objects using the json-lib, but I’m having trouble figuring out if I should use the XML or JSON data to store in the MS Excel file.

If someone could point me in the right direction, I would greatly appreciate it!

Thanks in advance,
BD


#2

Well, I don’t know if this hits the nail of your question on its head, but when working with Java and Excel, I usually work with Apache POI. Check whether this package includes a XML to Excel parser. Cheers, Senfman


#3

Just out of curiosity, how about returning JSON data in the first place?


#4

I use Apache POI as well to read/write Excel file but I’m not sure if there is a parser in the library. I will check though. Thanks.


#5

I’m not sure what you mean. The data that comes from the API call is returned in XML format.


#6

Oh sorry, now I see that some API returns XML. Personally I have more experience working with JSON and for me it is more code friendly. But if data are in XML I would personally tried to find a way to write it directly to Excel file.


#7

I know how to convert the XML data into JSON (I’ve done that already) but I’m not sure if it’s easier to write XML or JSON data into an Excel file. Do you know how to write JSON to an Excel file using Java?