JsonDataSource does not allow to retrieve a field as eg. a JsonNode, which can be very usefull if your json has nested object.
This is due to getFieldValue attempting to convert value even if there's no need to. Line 228 should be changed to if(selectObject != null && valueClass.isAssignableFrom(selectedObject.getClass())
Steps to reproduce
Create a json file with nested content, eg. [ { "customer": { "id: 38 } } ]
Create a report with a field customer, of class com.fasterxml.jackson.databind.node.ObjectNode
Run report => fails with Caused by: net.sf.jasperreports.engine.JRException: Field "customer" is of class com.fasterxml.jackson.databind.node.ObjectNode and can not be converted.
Modify the field as java.lang.Object => report works and you can use the field as an ObjectNode by casting it everywhere you need it (kind of boring)
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now