Refactoring the JSON request