Using JSON Data Source and Template



I'm a COMPLETE BEGINNER in Jasper Reports and JSON so please bear with me.

So in JAVA, I'm trying to fill a report template by code (as in like JasperFillManager.fillReport(blah,blah)) using a JSON file as it parameter source.

The JSON file that stores all of the information for the parameters willl be stored as a blob in a database and I will get it from the database in string form due to certain limitations with other technologies I am using.

The JSON file would store a default value and a sql query for each parameter. What I want to do is run the sql query to fill the report OR use the default value in the case that the sql query does not yield any results or is null itself.

The JSON file looks like this: In here, the parameters would be "ParameterName" and "WOMEN_ID"


"ParameterName": {

"default": "Parameter1",




"default": null,





I was wondering if you could help me figure out how to fill a template in the method I mentioned before. Thanks!


jiwlee.gatech's picture
Joined: Jun 29 2017 - 6:32am
Last seen: 2 years 12 months ago

1 Answer:


So you want something like pass a JSON data source for the report and that JSON data source will need to run SQL queries to obtain data for those values? That won't work unfortunately. You can either have an SQL query to a data source or have a JSON file as a data source. You can try to write a program that would execute these queries and form you a JSON file as a result which you can then feed to a JasperReport for data. Or create a custom data source object but that would also require additional coding.

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 1 week 3 days ago