serhii.net

In the middle of the desert you can say anything you want

13 Dec 2021

Convert nested OrderedDicts into dict

From SO1, if both are JSON serializable objects, you can use json:

from json import loads, dumps
from collections import OrderedDict

def to_dict(input_ordered_dict):
    return loads(dumps(input_ordered_dict))
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus