How to convert JSON to XML in ORACLE 11g?

Asked

Viewed 106 times

1

Good afternoon, I have a problem at work.

Need to create a Function in oracle that performs the conversion of json to xml and show the result as table.

I know version 12 of oracle does this easily, but unfortunately our base is still 11g.

Does anyone know a way to do this on Oracle 11g?

Thanks in advance!

1 answer

0

Erick, have you tested the "pljson"? He does what you need, in this post recommended and suggested the following test script:

declare
    v_json json := json('{
                          "EMPLOYEE":[
                                      {"NAME":"CLARK","JOB":"MANAGER","SALARY":2450},
                                      {"NAME":"KING","JOB":"PRESIDENT","SALARY":5000},
                                      {"NAME":"MILLER","JOB":"CLERK","SALARY":1300}
                                     ]
                         }'
                       );
    v_xml xmltype;
begin
    v_xml := json_xml.json_to_xml(v_json,'EMPLOYEES');
    dbms_output.put_line(dbms_xmlgen.convert(v_xml.getclobval(),1));
end;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.