make validation errors return JSON