Fix a long-standing bug where invalid JSON would be accepted by Synapse.