Blog > Groovy Scripts – Native Handling of JSON

Groovy Scripts – Native Handling of JSON

Michał Krawczyk SAP Mentor, SAP Press Author
icon__calendar 2020-07-02


Groovy provides us with many useful features. One of them that is definitely worth mentioning is the Native Handling of JSON.

Reading time: 3 minutes


Native handling of JSON with Groovy

In the recently published SAP PRESS E-Bite – “Developing Groovy Scripts for SAP Cloud Platform Integration”, that I had the pleasure of writing together with Vadim Klimov, we explained how to parse and generate JSON payloads using Groovy Scripts in CPI.

Many of you might be familiar with my open-source project, FormatConversionBean, that was initially available in PI since 2015, and later ported to CPI in 2018. JSON handling in those projects was implemented using a third-party library (

As we invested time to look into handling JSON with Groovy, it was only natural to revisit the implementation in FormatConversionBean for CPI.


FormatConversionBean for CPI release 2.2.0

I am pleased to say that with the latest release, it now uses Groovy’s built-in functionality instead of depending on the third party library. As a bonus, a minor feature was added allowing JSON fields to be forced as arrays using GPath notation (another Groovy native capability). If you ever need a handy Swiss-army-knife like a tool to handle your conversion needs (XML, JSON, Excel, flat files) in CPI, check it out on GitHub.


Isn’t Groovy great? I think it is. And it is also feature-packed!

If you want to learn more, explore our E-Bite:


Read also

1. Decoding Percent Encoded Octets in URLs.

2. Speed up your json2json transformation in SAP CPI with Groovyscript.


Michał Krawczyk SAP Mentor, SAP Press Author
SAP integration consultant since 2004. He has been recognized by SAP included becoming an SAP Mentor in 2007 and winning the top contributor/topic leader award from SDN (SAP Developer Network portal) in SAP PO/PI eight times. Michal is the author many SAP integration related books: Mastering idoc business scenarios with SAP XI , Mastering idoc business scenarios with SAP PI (second edition).