return error as json