Skip to content

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rapidxmltojson

rapidxmltojson converts xml str to json str

pip install rapidxmltojson

Examples

>>> import rapidxmltojson
>>> data = rapidxmltojson.parse("""
...     <root a="testa">
...         <child>
...             <item>text 1</item>
...             <item>text 2</item>
...         </child>
...         <example b="testb">
...             example text
...         </example>
...         <test-ns:example xmlns:test-ns="http://test-ns.com/">
...             example text (namespaced)
...         </test-ns:example>
...     </root>
... """)

>>> import json
>>> print(json.dumps(json.loads(data), indent=4))
{
    "root": {
        "@a": "testa",
        "child": {
            "item": [
                "text1",
                "text2"
            ]
        },
        "example": {
            "#text": "exampletext",
            "@b": "testb"
        },
        "test-ns:example": {
            "#text": "exampletext(namespaced)",
            "@xmlns:test-ns": "http://test-ns.com/"
        }
    }
}

About

rapidxmltojson python package

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages