Jasper Reports comes with a sample report using a JSON datasource, and the "jsonCustomerReport" shows exactly what I want it to, but it does so by requerying the entire datasource for each subreport, like so:
<subreportParameter name="net.sf.jasperreports.json.source">
<subreportParameterExpression><![CDATA["data/northwind.json"]]></subreportParameterExpression>
</subreportParameter>
Let's say I wanted the Customer Report that looks like this:
Maria Anders of Beverly Hills
Order #100
Order #101
Ana Trujillo of New York City
Order #102
Order #103
Order #104
But using this data as a string passed in as an InputStream:
{"SomeJsonObject": {
"Customers": [ {
"ContactName": "Maria Anders",
"CustomerID": "ALFKI",
"Address": {
"Street":"123 Sesame St",
"City":"Beverly Hills"
},
"Orders": [ {
"OrderID": 100 // Other stuff snipped
}, {
"OrderID": 101
}
]
}, {
"ContactName": "Ana Trujillo",
"CustomerID": "ANATR",
"Address": {
"Street":"456 Sesame St",
"City":"New York City"
},
"Orders": [ {
"OrderID": 102
}, {
"OrderID": 103
}, {
"OrderID": 104
}
]}
]}
}
How would I access the Orders array?
I wanted to use a SubDataSet and a List component, but I don't know what to put for the `dataSourceExpression`.