restructuring json for api