walid.asansas Posted November 15, 2020 Share Posted November 15, 2020 Hello,I have the following use case: we have a JsonNode object coming from our persistence layer, we want to create a JsonDataSource using that JsonNode object before filling a Jasper Report. Now the question is: why do we have to convert that JsonNode to InputStream before creating the JsonDataSource? While checking the code source of the JsonDataSource class I can see the following constructor: protected JsonDataSource(JsonNode jsonTree, String selectExpression) throws JRException {But it is coded as protected and we can't call it in our case, we found out that converting the object to InputStream in order to use the public constructor, which will in fact convert the object back to a JsonNode, is not optimal and therefore I would like to know if there is any fix for this case?public JsonDataSource(InputStream jsonStream, String selectExpression) throws JRException { this(JsonUtil.parseJson(jsonStream), selectExpression); }Thank you for your efforts! Link to comment Share on other sites More sharing options...
Recommended Posts
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