It's safer to parse the generated JSON and compare that to a dict. There's no guarantee that identical bits will be generated for both cases, even though the structures may compare equal.