I'm new to Python and I need to fetch some of the attribute values from a XML file and then to convert these values to JSON.
example:
<messages>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Dont forget me this weekend!</body>
</messages>
{
"from":"Jani",
"body":"Dont forget me this weekend!"
}
How can I best achieve this? Would I convert it to JSON first? If yes, which library would I use? Lxml? Or would I convert it to String and then use regex to get some of the values?