Its been a month since I worked on a feature in Jaspersoft Studio. Now that I have got some time to spend, I thought its best to provide a step by step approach to create a report using JSON File.
here we go…..
1) Create a simple JSON file with some JSON Data. For this purpose I have picked up a simple JSON example from this link.
I copied the example code and pasted that in a notepad and saved the file with *.json extension.
2) Create a New Report in Jaspersoft Studio and provide suitable name and save it in Repository.
3) Click “Next” to navigate to next screen where we need to create a new JSON Datasource. Click on New Button and select “JSON File” Object.
4) This will open a Data Adapter screen.
- Here provide a Name to the connection (In my ex I have named it as JsonDatasource).
- Browse to the text file (.json extension) which we saved as part of step 1.
- Check the Report Json Expression button
- Click Test
5) Once the Test is successful, Click Finish and JR will take you to New Report Wizard with your JSON Object tree.
6) Double Click on the Object on Top of tree. (In my example i have double clicked on employees). The Employees will appear on the right side of the screen.
7) Click Next Button and select the fields you require to build your report from the Left panel and push it to Right panel.Click Finish
8) This will create the Report Template. With JSON Datasource you cretaed and the fields you selected.
9) Drag and Drop the fields in detail section and create a sample report.
10) Click Preview to see the data present in your JSON File as output of the report.
Hence we created a simpel Report using a simple JSON Objects. I will update soon with how to cretae a report using JSON Array and Parameters etc.