Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Display XML as JSON

wowlJan 14 2019 — edited Jan 16 2019

I have an xml report stored in a clob and what i need to do is display the xml report as a json report within a report on an apex page.

I can get the xml version to display but I cant see a way to convert the xml to a json and then how to display it on an apex page.

The XML is valid and simple but i cant see how to convert it, i believe there are options in 12c but we are on version 11.2.0.4.0 I've also seen there are several javascript options but i'm not sure how to integrate one of these.

- Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

- PL/SQL Release 11.2.0.4.0 - Production

- CORE 11.2.0.4.0 Production

- TNS for Linux: Version 11.2.0.4.0 - Production

- NLSRTL Version 11.2.0.4.0 - Production

- Application Express 5.1.3.00.05

I knocked up the report on the apex website

https://apex.oracle.com/pls/apex/f?p=70820:1

workspace - blueowl

user - testuser

password - t3stus3r

This is an example of the xml i've got

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<XmlInterfaceRequest>

  <AddSgwM>

    <SgwMap>

      <Name>ZX</Name>

      <Description>ZX: Tel</Description>

      <MMc>12345</MMc>

      <SgwIpA>

        <IpA>191.168</IpA>

      </SgwIpA>

      <SgwIpA>

        <IpA>196.201</IpA>

      </SgwIpA>

      <SgwIpA>

        <IpA>196.27</IpA>

      </SgwIpA>

    </SgwMap>

    <SgwMap>

      <Name>ZW</Name>

      <Description>ZW: Tel</Description>

      <MMc>67890</MMc>

      <SgwIpA>

        <IpA>217.153</IpA>

      </SgwIpA>

      <SgwIpA>

        <IpA>217.152</IpA>

      </SgwIpA>

      <SgwIpA>

        <IpA>217.151</IpA>

      </SgwIpA>

    </SgwMap>

  </AddSgwM>

</XmlInterfaceRequest>

And i'd like the report to show

{

    "XmlInterfaceRequest": {

        "AddSgwM": {

            "SgwMap": [

                {

                    "Name": "ZX",

                    "Description": "ZX: Tel",

                    "MMc": "12345",

                    "SgwIpA": [

                        {

                            "IpA": "191.168"

                        },

                        {

                            "IpA": "196.201"

                        },

                        {

                            "IpA": "196.27"

                        }

                    ]

                },

                {

                    "Name": "ZW",

                    "Description": "ZW: Tel",

                    "MMc": "67890",

                    "SgwIpA": [

                        {

                            "IpA": "217.153"

                        },

                        {

                            "IpA": "217.152"

                        },

                        {

                            "IpA": "217.151"

                        }

                    ]

                }

            ]

        }

    }

}

This post has been answered by Pavel_p on Jan 15 2019
Jump to Answer
Comments
Post Details
Added on Jan 14 2019
4 comments
749 views