select xmlParserJson(column1) from table; and that will give xml data converted to json.
If offical oracle xml to json parse that will be recomended .
If not offical can you tell me the method to install and run xml parse . Thanks
select xmlParserJson(column1) from table; and that will give xml data converted to json.
If offical oracle xml to json parse that will be recomended .
If not offical can you tell me the method to install and run xml parse . Thanks
can you tell me the method to install and run xml parse
SELECT XMLTYPE( your_xml_string )
FROM DUAL
Will parse your XML.
If you want to extract the values then you can use XMLTABLE
or XMLQUERY
to get the values out of the XML.
will give xml data converted to json.
Parse the XML and extract the values using the above methods and then use the Oracle 12.2 functions JSON_ARRAY
, JSON_OBJECT
, JSON_ARRAYAGG
and JSON_OBJECTAGG
to create the JSON from the data.
How can i parse
<xml><name>himanshu</name></xml>
to be covert to json in oracle by these methods.
First, you can read the documentation and the examples in it and try it yourself. But you could try:
SELECT JSON_OBJECTAGG( id VALUE text )
FROM XMLTABLE(
'/xml/*'
PASSING XMLTYPE( '<xml><name>himanshu</name></xml>')
COLUMNS id VARCHAR2(200) PATH './name()',
text VARCHAR2(200) PATH './text()'
);
I'm not on an Oracle 12c system at the moment so it is untested.