Modify code to change the structure of JSON