Converting xml to json

I'm trying to do really simple thing: Converting xml to json.
I'm using xmlJson crate that is really old now.
Can somebody suggest how to do it in modern way?
Thanks

At the core you'll need to make some decisions:

  • how do you represent attributes in JSON?
  • how do you represent children in JSON?

If you jam both into child objects in the JSON, then the conversion is lossy because you'll have effectively turned XML attrs into children.

I was actually asking about crate that will let me do it.

In that case, as usual you can take a look at crates.io.

I was and apparently there is a create xmlJson which I've mentioned in my OP, but the examples provided do not work. I also mention in my OP that the crate is rather old. That's why I'm asking this question here, to see how it is done in modern way.

If you click on the link, you'll find a number of search results for "XML to JSON".
If what you're looking for isn't on this list, then there is no published crate that does what you want.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.