Only OrderedDicts are returned
See original GitHub issueThis may just be a documentation issue, but when I run: (Python 2.7 OS X)
foo = xmltodict.parse("""<?xml version="1.0" ?>
<person>
<name>john</name>
<age>20</age>
</person>""")
print foo
I get:
Output: OrderedDict([(u’person’, OrderedDict([(u’name’, u’john’), (u’age’, u’20’)]))])
In a nested XML document, this is making hard for me to turn this into JSON
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:9 (1 by maintainers)
Top Results From Across the Web
OrderedDict vs dict in Python: The Right Tool for the Job
Iterating Over an OrderedDict. Just like with regular dictionaries, you can iterate through an OrderedDict object using several tools and techniques. You can ......
Read more >python - Does ordered dict return keys in order too?
Yes, OrderedDict will return the keys in order. It is worth mentioning, however, that the keys views compare order insensitive which is ...
Read more >OrderedDict in Python
An OrderedDict is a dictionary subclass that remembers the order that keys were first inserted. The only difference between dict() and ...
Read more >collections — Container datatypes
Returns a new ChainMap containing a new map followed by all of the maps in the current instance. If m is specified, it...
Read more >Python OrderedDict
When we iterate over an OrderedDict, items are returned in the order they were inserted. A regular dictionary doesn't track the insertion order....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@scharfmn I just found that you can use:
In future if Python 3.7+ is detected then instead of
collections.OrderedDict
the normaldict
can be used by default because it will preserve the order by default.