code refactoring & change code to id in the json data