<?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: XML to JSON conversion issues with Boolean and Double data types in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaa-p/12165449#M4548880</link>
    <description>&lt;P&gt;HI &lt;SPAN class="mention-scrubbed"&gt;amallick&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Query 1:&lt;/STRONG&gt;Cloud Integration converter is treating all data types as strings.&lt;BR /&gt;&lt;BR /&gt;Please check &lt;A href="https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/4bf5a05cad514218a3a986531ada30b6.html"&gt;Limitations for XML-to-JSON Conversion &lt;BR /&gt;&lt;BR /&gt;&lt;/A&gt;"No conversion to JSON primitive types for XML to JSON. All XML element/attribute values are transformed to a JSON string."&lt;BR /&gt;&lt;BR /&gt;And the same is also referred in 2521044 - CPI: XML to JSON Converter treats Integer as String&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;for the error&lt;/STRONG&gt;:&lt;BR /&gt;Can you please attach the groovy script and body that you are passing to it (you can capture the same by enabling trace)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Bibhu&lt;/P&gt;</description>
    <pubDate>Wed, 08 Apr 2020 20:35:07 GMT</pubDate>
    <dc:creator>ibibhu</dc:creator>
    <dc:date>2020-04-08T20:35:07Z</dc:date>
    <item>
      <title>XML to JSON conversion issues with Boolean and Double data types</title>
      <link>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaq-p/12165448</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
  &lt;P&gt;I'm trying to use the standard XML to JSON Converter on the Cloud Platform Integration iFlow, but facing the following challenges:&lt;/P&gt;
  &lt;P&gt;1. In traditional PO environment when we use the REST receiver adapter and do the XML to JSON conversion, it does not add double quotes (" ") around Boolean data types, but the Cloud Integration converter is treating all data types as strings.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1798460-13.png" /&gt;&lt;/P&gt;
  &lt;P&gt;2. Again in traditional PO environment we could provide the default values in the adapter XML/JSON conversion rules, like following:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1798461-11.png" /&gt;&lt;/P&gt;
  &lt;P&gt;But I couldn't find a place in the Cloud Integration converter to do the same and it's also double quotes around Decimal/Double data types, like:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1798462-12.png" /&gt;&lt;/P&gt;
  &lt;P&gt;I feel a need to use a Groovy script, but I'm not an expert and there are not good documentation available on the internet today. I looked into SAP note 2521044 and tried using the sample groovy attached to it, but received the following error:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1798463-14.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Looking forward to the experts to help me resolve it.&lt;/P&gt;
  &lt;P&gt;Thank you,&lt;/P&gt;
  &lt;P&gt;Anirban&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 20:11:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaq-p/12165448</guid>
      <dc:creator>amallick</dc:creator>
      <dc:date>2020-04-08T20:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: XML to JSON conversion issues with Boolean and Double data types</title>
      <link>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaa-p/12165449#M4548880</link>
      <description>&lt;P&gt;HI &lt;SPAN class="mention-scrubbed"&gt;amallick&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Query 1:&lt;/STRONG&gt;Cloud Integration converter is treating all data types as strings.&lt;BR /&gt;&lt;BR /&gt;Please check &lt;A href="https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/4bf5a05cad514218a3a986531ada30b6.html"&gt;Limitations for XML-to-JSON Conversion &lt;BR /&gt;&lt;BR /&gt;&lt;/A&gt;"No conversion to JSON primitive types for XML to JSON. All XML element/attribute values are transformed to a JSON string."&lt;BR /&gt;&lt;BR /&gt;And the same is also referred in 2521044 - CPI: XML to JSON Converter treats Integer as String&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;for the error&lt;/STRONG&gt;:&lt;BR /&gt;Can you please attach the groovy script and body that you are passing to it (you can capture the same by enabling trace)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Bibhu&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 20:35:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaa-p/12165449#M4548880</guid>
      <dc:creator>ibibhu</dc:creator>
      <dc:date>2020-04-08T20:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: XML to JSON conversion issues with Boolean and Double data types</title>
      <link>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaa-p/12165450#M4548881</link>
      <description>&lt;P&gt;Hi Anirban&lt;/P&gt;&lt;P&gt;As you've discovered, the XML to JSON converter in CPI doesn't have a lot of functionality at this point. As mentioned in the note, all values are treated as strings, even though all values are not strings, obviously.&lt;/P&gt;&lt;P&gt;For now, you will have to clean up the JSON with a Groovy script. I don't see a problem with the sample script attached to the note.&lt;/P&gt;&lt;P&gt;I would suggest that you try and update the script yourself. If it doesn't work out, post a new question and include the script code, a sample of the JSON you want to clean up and what it should look like after it's been cleaned up. Post everything as text, please, for easier copy-pasting (i.e. not images).&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Morten&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 20:38:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaa-p/12165450#M4548881</guid>
      <dc:creator>MortenWittrock</dc:creator>
      <dc:date>2020-04-08T20:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: XML to JSON conversion issues with Boolean and Double data types</title>
      <link>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaa-p/12165451#M4548882</link>
      <description>&lt;P&gt;Hi Morten,&lt;/P&gt;&lt;P&gt;Thanks for the comment, I opened a new question with the details and closing this thread.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anirban&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 21:01:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xml-to-json-conversion-issues-with-boolean-and-double-data-types/qaa-p/12165451#M4548882</guid>
      <dc:creator>amallick</dc:creator>
      <dc:date>2020-04-08T21:01:44Z</dc:date>
    </item>
  </channel>
</rss>

