Fix a long-standing bug where invalid JSON would be accepted over the HTTP interfaces.