use json.loads when checking for duplicate states

Can't compare JSON strings reliably since the order of keys may change
between loads/dumps.