<?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>topic Re: Convert XML string to JSON format in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862844#M1959159</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One XML may correspond to several possibilities in JSON. I guess there could be a minimalist conversion function module (or whatever), but I feel it would be no sense, so my conclusion is that you always need a home made algorithm to convert. Why not with SMUM_XML_PARSE if it suits your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;For instance, who knows if &amp;lt;tab&amp;gt;&amp;lt;line&amp;gt;1&amp;lt;line&amp;gt;&amp;lt;/tab&amp;gt; is to be converted into {"tab":{"line":1}} or into {"tab":[{"line":"1"}]}&lt;/P&gt;&lt;P&gt;So you must create a program (see Horst answer)&lt;/P&gt;&lt;P&gt;PS: maybe a tool could be developped, which receives both XML + XSD, then it would be able to convert correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jul 2016 13:38:24 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2016-07-27T13:38:24Z</dc:date>
    <item>
      <title>Convert XML string to JSON format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862843#M1959158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement where I have to convert a string in XML format into corresponding JSON format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The existing serializer does not recognise the tags and treats the entire string as one long text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using the XML parser( SMUM_XML_PARSE) which would return an internal table with the tags and corresponding values. JSON string generated from it treats the tags and values as value fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know whether my approach is right here or whether I should go about it differently.&amp;nbsp; Also, I would appreciate some guidance on converting a string in XML format into corresponding JSON format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Renjith&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 10:15:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862843#M1959158</guid>
      <dc:creator>former_member371634</dc:creator>
      <dc:date>2016-07-27T10:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Convert XML string to JSON format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862844#M1959159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One XML may correspond to several possibilities in JSON. I guess there could be a minimalist conversion function module (or whatever), but I feel it would be no sense, so my conclusion is that you always need a home made algorithm to convert. Why not with SMUM_XML_PARSE if it suits your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;For instance, who knows if &amp;lt;tab&amp;gt;&amp;lt;line&amp;gt;1&amp;lt;line&amp;gt;&amp;lt;/tab&amp;gt; is to be converted into {"tab":{"line":1}} or into {"tab":[{"line":"1"}]}&lt;/P&gt;&lt;P&gt;So you must create a program (see Horst answer)&lt;/P&gt;&lt;P&gt;PS: maybe a tool could be developped, which receives both XML + XSD, then it would be able to convert correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 13:38:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862844#M1959159</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-07-27T13:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert XML string to JSON format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862845#M1959160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to do it in ABAP, you might &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;either write an &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abenabap_xslt.htm"&gt;XSLT&lt;/A&gt; (TA STRANS)&amp;nbsp; that converts your XML into &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abenabap_json_xml.htm"&gt;JSON-XML&lt;/A&gt; and &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abapcall_transformation.htm"&gt;transform&lt;/A&gt; the result into a &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abenabap_json_sxml.htm"&gt;JSON-writer&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;or &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abenabap_sxml_lib_parse.htm"&gt;parse&lt;/A&gt; your XML with methods of the sXML-library, convert it to &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abenabap_json_xml.htm"&gt;JSON-XML&lt;/A&gt; and render it into a &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abenabap_json_sxml.htm"&gt;JSON-writer&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 14:54:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862845#M1959160</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2016-07-27T14:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert XML string to JSON format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862846#M1959161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've written an example, how one could do it in ABAP now, see &lt;A __default_attr="145789" __jive_macro_name="blogpost" class="jive_macro jive_macro_blogpost" data-orig-content="Converting XML to JSON with ABAP - A Quest" href="https://community.sap.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Aug 2016 09:06:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xml-string-to-json-format/m-p/11862846#M1959161</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2016-08-04T09:06:02Z</dc:date>
    </item>
  </channel>
</rss>

