refactoring the json result