How to use JSON list as data in a Table in a Jasper Report

I have a JSONDatasource that I want to use to create a report.  The data contains a list of items I want to present in a Table.  The data looks like:

{ "sensors":{ "reportDate:"12-04-2014",
        "rows":[
            {"eventCode":2},{"eventCode":3},{"eventCode":4},{"eventCode":5}

] } }

I am able to acces the report date with the following:

<queryString language="json">
        <![CDATA[sensors]]>
    </queryString>
    <field name="reportDate" class="java.lang.String">
        <fieldDescription><![CDATA[reportDate]]></fieldDescription>
    </field>

I cannot figure out how to use the rows in a table.  There is not much on the web and the documentation and samples only talk about subreports which this is not.

 

Thanks

Scott

scott_ryan_1's picture
Joined: Jun 24 2014 - 12:07pm
Last seen: 9 years 3 months ago

Yes ,you are right ..No one is giving exact solution ,only talking other things. Am alsofacing this issue ,and trrying to find since week. but i didn't ..

pravin_sarode - 7 years 6 days ago

2 Answers:

I've recently posted an answer to a similar question on StackOverflow: http://stackoverflow.com/a/39568989/5882963

Although my answer involves using a List due to its simpler syntax, the switch to a Table should be fairly easy.

If you have any issues I'll add a complete solution for your case.

narcism's picture
6470
Joined: Nov 22 2010 - 12:39am
Last seen: 1 day 12 hours ago

Please provide me complete solution. I have sean it but as I am new to jasper soft I am totally confused. 

If you can provide me jr xml code similar to my solution using json as shown in exmaple and table as shown in example having rowspan on <td> based on inner json list that would be really helpful for me.

As we are on the peak of deadlines. 

 

Looking forward for your reply

vakhariaaman's picture
Joined: May 20 2018 - 10:42pm
Last seen: 5 years 3 months ago
Feedback