How to fill report using JSON datasource without getting null values?

前端 未结 3 465
情深已故
情深已故 2020-12-11 08:01

I\'m using Jasper Reports to build a simple report pdf. I have a JSON file that looks like this:

{\"employees\": [
    {\"firstName\" : \"John\", \"lastName\         


        
3条回答
  •  不思量自难忘°
    2020-12-11 08:52

    If you pass your json string as InputStream then it will works.

    String reportContents = "{}" //your json
    InputStream is = new ByteArrayInputStream(reportContent.getBytes());
    Map params = new HashMap();
    params.put(JsonQueryExecuterFactory.JSON_INPUT_STREAM, is);
    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params);
    

提交回复
热议问题