I am trying to generate pdf with Apache FOP and I will be receiving input data in JSON format. Is there a way to loop over the JSON input in XSL-FO.
You need to transform your source -- JSON data, in your case -- into XML in the XSL-FO vocabulary that an XSL Formatter understands.
If you want to use XSLT to do the transformation into XSL-FO, you will find this easier to do if you use an XSLT 3.0 processor, since XSLT 3.0 added built-in support for transforming JSON. See, e.g.: