Refactored the code to use the new JsonRequest.