0

I have a long JSON file and i want to copy a specific element from it(i know its name) to an excel file.

image

eg :: Suppose i want to make an excel file having "Product" (Baleno, i20, Ford Figo etc) imported from a JSON file, how to do it using GET POST or without AJAX.

rjdkolb
  • 10,377
  • 11
  • 69
  • 89
Simrat
  • 1

2 Answers2

0

So, obviously there are ways to write this yourself. What I recommend, however, is using a library (or two. I'd recommend JSON Simple and/or Apache POI) Software engineering is about efficiency, and that includes for the engineer. Using libraries is not shameful. I'd recommend doing that first. Try out using librarys, okay?

-Batista

Jacob B.
  • 423
  • 3
  • 12
0

One simple method I have used, when you only require the content you have in the JSON and if the output needs no formatting!

Create/Construct/Return a CSV File containing the content.

Product,Q1Sales,Q2Sales,Q3SalesQ4Sales
"Baleno",6000,5000,7000,5500

Return the Mimetype Filename as "BalenoSales.xls"

Make the Suffix of the Servlet URL ".xls" as well so Excel/IE likes it.

Andrew Russell
  • 476
  • 6
  • 15