@RequirePOST
    @Restricted(NoExternalUse.class)
    public void doViewExport(StaplerRequest2 req, StaplerResponse2 res) throws Exception {
        if (!Jenkins.get().hasPermission(Jenkins.SYSTEM_READ)) {
            res.sendError(HttpServletResponse.SC_FORBIDDEN);
            return;
        }

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        export(out);

        req.setAttribute("export", out.toString(StandardCharsets.UTF_8.name()));
        req.getView(this, "viewExport.jelly").forward(req, res);
    }
Export JSONSchema to URL
@throws Exception
plugin/src/main/java/io/jenkins/plugins/casc/ConfigurationAsCode.java