Open stephenHartzell opened 10 years ago
I was looking for this also, it seems all dict keys are treated like child nodes, maybe we can get keys starting with '@' (since they're invalid XML node names) to be treated as custom attributes, so we end up with something like:
{
'checkout': {
'@currency': 'BRL',
'@text': 10.5
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<checkout type="dict" currency="BRL">
10.5
</checkout>
</root>
We might lose attribute types and will only be possible on dicts. Is this something like this already possible?
This would be awesome to have. I need to be able to add 'name' attributes to generate Android externalized string resource files.
Great approach @mstrcnvs, would love to see it implemented.
+1
Was this ever implemented or at the very least in a fork?
Also need it.
@BowenFu I ended up using the xmler
package. For user, checkout https://github.com/neetjn/polymath-engineering-challenge/blob/master/polymath/core.py
@neetjn Thanks. That is very helpful.
Hi guys,
Crazy to think that this issue has gone back all the way to 2014. I have started developing a solution you can see over on #66. Let me know what you guys think. Feedback is much appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<checkout type="dict" currency="BRL">
10.5
</checkout>
</root>
may be converted to json
{
"checkout": {
"-type": "dict",
"-currency": "BRL",
"#text": "\n 10.5\n "
}
}
You can do that with xmltodict. It supports it both ways.
Maybe this can already be done, but I haven't seen it. Can insert custom attributes other than "type" and "id"?
The reason I bring this up is that this could very easily support converting a json file into a kml file save for that limitation.