return error messages as json