Does dumps() guarantee that the keys of a dictionary are sorted in a consistent manner? It may be safer to use loads() and compare the results than to assume the serialization will look the same.