Getting data from another json file

Hello everyone :slight_smile:
Im newbie with using Yarg, so i got a question.

In sample project, yarg getting data from Data.json file in resources.

@GetMapping(value = "/generate/*")
    public void generateDocument(HttpServletResponse response)
            throws IOException {

        ReportBuilder reportBuilder = new ReportBuilder();
        ReportTemplateBuilder reportTemplateBuilder = new ReportTemplateBuilder()
                .documentPath("./src/main/resources/Letter.docx")
                .documentName("Letter.docx")
                .outputType(ReportOutputType.docx)
                .readFileFromPath();
        reportBuilder.template(reportTemplateBuilder.build());

        BandBuilder bandBuilder = new BandBuilder();
        String json = FileUtils.readFileToString(new File("./src/main/resources/Data.json"));
        ReportBand main = bandBuilder.name("Main")
                .query("Main", "parameter=param1 $.main", "json")
                .build();
        reportBuilder.band(main);
        Report report = reportBuilder.build();

        Reporting reporting = new Reporting();
        reporting.setFormatterFactory((ReportFormatterFactory) new DefaultFormatterFactory());
        reporting.setLoaderFactory(
                new DefaultLoaderFactory().setJsonDataLoader(new JsonDataLoader()));
        response.setContentType(
                "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
        reporting.runReport(
                new RunParams(report).param("param1", json),
                response.getOutputStream());

    }

I’d like to change that to getting data from another json file. In my project, im able to put some data by form into json, also get it on path “localhost:8080/all.json”.

Does anyone know how to do this?

Hello.

You need to change this line to address to your file
String json = FileUtils.readFileToString(new File("./src/main/resources/Data.json"));

And then you should change the annotation
@GetMapping(value = "/generate/*") to @GetMapping(value = "/all.json").