<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Convert Json to XML  with validation using Groovy ? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746567#M4784254</link>
    <description>Hi &lt;SPAN class="mention-scrubbed"&gt;joel.langoyan&lt;/SPAN&gt;&lt;P&gt;Thank you for reply, you are correct we can use standard json to xml converter but in my case we have 2 incoming payloads, If case 1 data come we need to validate(If validation = True) then send email alert to team OR Case 2 data come (validation = False) then build the XML and post to target system.&lt;/P&gt;Please check input payloads above case 1, case 2.&lt;BR /&gt;Regards,&lt;BR /&gt;Raj</description>
    <pubDate>Thu, 19 Oct 2023 08:50:37 GMT</pubDate>
    <dc:creator>former_member873987</dc:creator>
    <dc:date>2023-10-19T08:50:37Z</dc:date>
    <item>
      <title>Convert Json to XML  with validation using Groovy ?</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaq-p/12746565</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
  &lt;P&gt;I want to convert incoming Json payload to XML with validation using groovy. Please find input payloads,&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;Case 1&lt;/STRONG&gt;:If validation is true then send email alert to business team.Below is input payload.&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt; "id": "INGAO0",&lt;/P&gt;
  &lt;P&gt; "order_number": "WorkOrder",&lt;/P&gt;
  &lt;P&gt; "service": "boarding",&lt;/P&gt;
  &lt;P&gt; "validationdata": [&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; "reason": "hardware-Windows Laptop 16 Bundle with standard accessorieseeh is invalid",&lt;/P&gt;
  &lt;P&gt; "type": "Data error"&lt;/P&gt;
  &lt;P&gt; },&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; "reason": "supplying_company_agency_name is mandatory",&lt;/P&gt;
  &lt;P&gt; "type": "Data missing"&lt;/P&gt;
  &lt;P&gt; },&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; "reason": "start_date-2023-07-318 is invalid format",&lt;/P&gt;
  &lt;P&gt; "type": "Technical error"&lt;/P&gt;
  &lt;P&gt; },&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; "reason": "end_date is mandatory",&lt;/P&gt;
  &lt;P&gt; "type": "Data missing"&lt;/P&gt;
  &lt;P&gt; }&lt;/P&gt;
  &lt;P&gt; ]&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt; Case 2: If validation is false then build the xml,For this input payload is below&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt; "id": "INGAO0",&lt;/P&gt;
  &lt;P&gt; "order_number": WorkOrder",&lt;/P&gt;
  &lt;P&gt; "boardingtickets": "RIGM5020790"&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;Both cases i need to write in single groovy then we can check in router.Please help me.Regards,Raj&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 04:06:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaq-p/12746565</guid>
      <dc:creator>former_member873987</dc:creator>
      <dc:date>2023-10-19T04:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Json to XML  with validation using Groovy ?</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746566#M4784253</link>
      <description>&lt;P&gt;Hi Raj&lt;/P&gt;&lt;P&gt;Why don't you just use standard json to xml converter and then on your router have an xpath expression if the &amp;lt;validationdata&amp;gt; exists or not. That is my simplest understanding what you intend to happen. Kindly elaborate more details if that is not the case&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 08:34:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746566#M4784253</guid>
      <dc:creator>joel_langoyan</dc:creator>
      <dc:date>2023-10-19T08:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Json to XML  with validation using Groovy ?</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746567#M4784254</link>
      <description>Hi &lt;SPAN class="mention-scrubbed"&gt;joel.langoyan&lt;/SPAN&gt;&lt;P&gt;Thank you for reply, you are correct we can use standard json to xml converter but in my case we have 2 incoming payloads, If case 1 data come we need to validate(If validation = True) then send email alert to team OR Case 2 data come (validation = False) then build the XML and post to target system.&lt;/P&gt;Please check input payloads above case 1, case 2.&lt;BR /&gt;Regards,&lt;BR /&gt;Raj</description>
      <pubDate>Thu, 19 Oct 2023 08:50:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746567#M4784254</guid>
      <dc:creator>former_member873987</dc:creator>
      <dc:date>2023-10-19T08:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Json to XML  with validation using Groovy ?</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746568#M4784255</link>
      <description>&lt;P&gt;Hi Raj,&lt;/P&gt;&lt;P&gt;What is validation exactly you are looking for? Is there a specific field or value in the input payload that you need to check? Is it the whole input JSON payload valid or not? &lt;/P&gt;&lt;P&gt;What do you mean exactly by 'IF validation = true or false'? If it is just to check whether the &lt;STRONG&gt;validationdata&lt;/STRONG&gt; array exist or not then as already described you can do so as xpath condition in the router after standard converter. The most significant difference in your cases as you describe is just whether validationdata is in the payload &lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2220493-capture.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 10:17:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746568#M4784255</guid>
      <dc:creator>joel_langoyan</dc:creator>
      <dc:date>2023-10-19T10:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Json to XML  with validation using Groovy ?</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746569#M4784256</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;joel.langoyan&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;We have 2 cases if validation is true then send email with different field(See in case 1 input data) and validation is false post to target system with different fields, For these i was taken 2 times mapping. We don't need 2 mappings, instead of that  we prefer Groovy script. Actually i am new to groovy please help me.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 11:38:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746569#M4784256</guid>
      <dc:creator>former_member873987</dc:creator>
      <dc:date>2023-10-19T11:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Json to XML  with validation using Groovy ?</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746570#M4784257</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;As &lt;SPAN class="mention-scrubbed"&gt;joel.langoyan&lt;/SPAN&gt; mentions in his answer, you don't need a Groovy script for this. It can be solved very nicely using the built-in flow steps. And if you are new to Groovy, then you &lt;EM&gt;definitely&lt;/EM&gt; should use the built-in steps instead.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Morten&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 12:38:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-json-to-xml-with-validation-using-groovy/qaa-p/12746570#M4784257</guid>
      <dc:creator>MortenWittrock</dc:creator>
      <dc:date>2023-10-19T12:38:01Z</dc:date>
    </item>
  </channel>
</rss>

