Converting json to xml using PostgreSQL

i need to convert a json data to xml. the sample code is as below.

from json2xml import json2xml
from json2xml.utils import readfromurl, readfromstring, readfromjson
data = readfromstring(

 '{"ra:covered-product-agreement":{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}}'
)
return json2xml.Json2xml(data, attr_type=False).to_xml()

where “ra” is the namespace. but the conversion is not exactly happening.

the result expecting is

<ra:covered-product-agreement>
        <login>mojombo</login>
        <id>1</id>
        <avatar_url>https://avatars0.githubusercontent.com/u/1?v=4</avatar_url>
    </ra:covered-product-agreement>

with current version the result received is

<key name="ra:covered-product-agreement">
        <login>mojombo</login>
        <id>1</id>
        <avatar_url>https://avatars0.githubusercontent.com/u/1?v=4</avatar_url>
    </key>

Please suggest a way to achieve this.

Thank you

Read more here: Source link