{"id":6254,"date":"2020-07-02T11:26:14","date_gmt":"2020-07-02T09:26:14","guid":{"rendered":"https:\/\/int4.com\/?p=6254"},"modified":"2020-07-10T12:35:46","modified_gmt":"2020-07-10T10:35:46","slug":"groovy-scripts-native-handling-of-json","status":"publish","type":"post","link":"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json","title":{"rendered":"Groovy Scripts – Native Handling of JSON"},"content":{"rendered":"

Introduction<\/h2>\n

Groovy provides us with many useful features. One of them that is definitely worth mentioning is the N<\/strong>ative Handling of JSON<\/strong><\/span>.<\/p>\n<\/div><\/span><\/span><\/strong><\/p>\n

Reading time: 3 minutes<\/em><\/span><\/strong><\/p>\n

 <\/p>\n

Native handling of JSON with Groovy<\/h3>\n

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

Many of you might be familiar with my open-source project, FormatConversionBean, that was initially available in PI<\/a> since 2015, and later ported to CPI<\/a> in 2018. JSON handling in those projects was implemented using a third-party library (https:\/\/github.com\/stleary\/JSON-java<\/a>).<\/p>\n

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

 <\/p>\n

FormatConversionBean for CPI release 2.2.0<\/h3>\n

I am pleased to say that with the latest release<\/a>, 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<\/a>.<\/p>\n

 <\/p>\n

Isn’t Groovy great? I think it is. And it is also feature-packed!<\/p>\n

If you want to learn more, explore our E-Bite<\/strong>: https:\/\/bit.ly\/37BSL9R<\/a>.<\/p>\n

 <\/p>\n

Read also<\/h4>\n

1. Decoding Percent Encoded Octets in URLs.<\/a><\/p>\n

2. Speed up your json2json transformation in SAP CPI with Groovyscript.<\/a><\/p>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

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 […]<\/p>\n","protected":false},"author":22,"featured_media":6260,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":""},"categories":[1],"tags":[204,74],"acf":[],"yoast_head":"\nGroovy Scripts - Native Handling of JSON - INT4<\/title>\n<meta name=\"description\" content=\"Groovy provides us with many useful features. One of them that is definitely worth mentioning is the native handling of JSON.\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Groovy Scripts - Native Handling of JSON - INT4\" \/>\n<meta property=\"og:description\" content=\"Groovy provides us with many useful features. One of them that is definitely worth mentioning is the native handling of JSON.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json\" \/>\n<meta property=\"og:site_name\" content=\"INT4\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-02T09:26:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-10T10:35:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/test11988.futurehost.pl\/wp-content\/uploads\/2020\/07\/Groovy_Scripts_Native_Handling-of-JSON_Yeoh.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"627\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Eng Swee Yeoh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eng Swee Yeoh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json\",\"url\":\"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json\",\"name\":\"Groovy Scripts - Native Handling of JSON - INT4\",\"isPartOf\":{\"@id\":\"https:\/\/test11988.futurehost.pl\/#website\"},\"datePublished\":\"2020-07-02T09:26:14+00:00\",\"dateModified\":\"2020-07-10T10:35:46+00:00\",\"author\":{\"@id\":\"https:\/\/test11988.futurehost.pl\/#\/schema\/person\/befacd34ba743472706672335a754070\"},\"description\":\"Groovy provides us with many useful features. One of them that is definitely worth mentioning is the native handling of JSON.\",\"breadcrumb\":{\"@id\":\"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/test11988.futurehost.pl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Groovy Scripts – Native Handling of JSON\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/test11988.futurehost.pl\/#website\",\"url\":\"https:\/\/test11988.futurehost.pl\/\",\"name\":\"INT4\",\"description\":\"Your soft landing in SAP API testing\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/test11988.futurehost.pl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/test11988.futurehost.pl\/#\/schema\/person\/befacd34ba743472706672335a754070\",\"name\":\"Eng Swee Yeoh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/test11988.futurehost.pl\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4efd478804448d5d5fe5235771cf2620?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4efd478804448d5d5fe5235771cf2620?s=96&d=mm&r=g\",\"caption\":\"Eng Swee Yeoh\"},\"description\":\"Go-to expert in SAP integration currently focusing on Groovy and Camel, digging deep into SAP Cloud Platform Integration (CPI).\",\"url\":\"https:\/\/test11988.futurehost.pl\/author\/engsy\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Groovy Scripts - Native Handling of JSON - INT4","description":"Groovy provides us with many useful features. One of them that is definitely worth mentioning is the native handling of JSON.","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_GB","og_type":"article","og_title":"Groovy Scripts - Native Handling of JSON - INT4","og_description":"Groovy provides us with many useful features. One of them that is definitely worth mentioning is the native handling of JSON.","og_url":"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json","og_site_name":"INT4","article_published_time":"2020-07-02T09:26:14+00:00","article_modified_time":"2020-07-10T10:35:46+00:00","og_image":[{"width":"1200","height":"627","url":"https:\/\/test11988.futurehost.pl\/wp-content\/uploads\/2020\/07\/Groovy_Scripts_Native_Handling-of-JSON_Yeoh.png","type":"image\/png"}],"author":"Eng Swee Yeoh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Eng Swee Yeoh","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json","url":"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json","name":"Groovy Scripts - Native Handling of JSON - INT4","isPartOf":{"@id":"https:\/\/test11988.futurehost.pl\/#website"},"datePublished":"2020-07-02T09:26:14+00:00","dateModified":"2020-07-10T10:35:46+00:00","author":{"@id":"https:\/\/test11988.futurehost.pl\/#\/schema\/person\/befacd34ba743472706672335a754070"},"description":"Groovy provides us with many useful features. One of them that is definitely worth mentioning is the native handling of JSON.","breadcrumb":{"@id":"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/test11988.futurehost.pl\/groovy-scripts-native-handling-of-json#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/test11988.futurehost.pl\/"},{"@type":"ListItem","position":2,"name":"Groovy Scripts – Native Handling of JSON"}]},{"@type":"WebSite","@id":"https:\/\/test11988.futurehost.pl\/#website","url":"https:\/\/test11988.futurehost.pl\/","name":"INT4","description":"Your soft landing in SAP API testing","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/test11988.futurehost.pl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/test11988.futurehost.pl\/#\/schema\/person\/befacd34ba743472706672335a754070","name":"Eng Swee Yeoh","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/test11988.futurehost.pl\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4efd478804448d5d5fe5235771cf2620?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4efd478804448d5d5fe5235771cf2620?s=96&d=mm&r=g","caption":"Eng Swee Yeoh"},"description":"Go-to expert in SAP integration currently focusing on Groovy and Camel, digging deep into SAP Cloud Platform Integration (CPI).","url":"https:\/\/test11988.futurehost.pl\/author\/engsy"}]}},"_links":{"self":[{"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/posts\/6254"}],"collection":[{"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/comments?post=6254"}],"version-history":[{"count":0,"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/posts\/6254\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/media\/6260"}],"wp:attachment":[{"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/media?parent=6254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/categories?post=6254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/test11988.futurehost.pl\/wp-json\/wp\/v2\/tags?post=6254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}