Search code examples
javajsonreport

Create a report from Java using JSON file


Want to create a tabular report from Java using JSON file. I have an 861 kb Json report with me.

Kindly suggest me the approach need to be followed.


Solution

  • It sounds like your input is JSON. You did not specify an output format. But similar as in HTML you could place tabular data into JSON as well. Assuming that is the case, all you need is a JSON parser/serializer and inbetween some Java code to adapt one format for the other.

    To transfer one XML data structure into another XML data structure there are nice tools like XSLT. Some of the implementations can also be used for JSON documents. See https://stackoverflow.com/a/49011455/4222206

    With the above assumption your code would perform these steps:

    1. Parse input JSON
    2. Run XSLT for JSON
    3. Serialize the obtained output