Closed wjur closed 7 years ago
There is currently no support for OrderedDicts in jsonmerge.
After a quick look through the code, your OrderedDicts in the input are probably converted to unordered by the dict()
call in ObjectMerge.merge()
method. I guess you could change that to copy.copy()
to preserve the original class.
Another option would be to implement something like the object_pairs_hook
in Python's json.load()
.
FYI pull request #27 implements support for OrderedDicts. You might want to check if it fits your particular use case.
If I merge two ordered dict then the result is a dict. I know that order in json is not important, but we want the fields in our json file to be in a particular (for readability). Are OrderedDicts supported? Maybe I'm missing something. Is there any workaround for this?