The Solution to json.dump throwing "TypeError: {...} is not JSON serializable" on seemingly valid object? is
Because it's not actually a dictionary; it's another mapping type that looks like a dictionary. Use type() to verify. Pass it to dict() to get a real dictionary from it.