add json response on success and error