You need to sign in to do that
Don't have an account?
Hartley
Restructure List into new nested List
Hey,
I can't seem to figure this out but I have a list of records that sort of looks like this
Essentially I want to restructure the List into a new list grouped by code and section. All records with section LON1 are nested under the Key LON1 with all data form that record something like:
I can't seem to figure this out but I have a list of records that sort of looks like this
{ "key_1": "25877", "key_2": "321565", "key_3": "0033600000NP8IAAA1", "key_4": "a0436000008XuS2AAK", "key_6": "London", "key_7": "a053600000AiAe5AAF", "key_8": -{ "title": "Public Speaking", "code": "WI2016", "section": "LON1", "Id": "a0436000008XuS2AAK" } }, { "key_1": "25877", "key_2": "321565", "key_3": "0033600000NP8IAAA1", "key_4": "a0436000008XuS2AAK", "key_6": "London", "key_7": "a053600000AiAe5AAF", "key_8": -{ "title": "Public Speaking", "code": "WI2016", "section": "LON2", "Id": "a0436000008XuS2AAK" } },
Essentially I want to restructure the List into a new list grouped by code and section. All records with section LON1 are nested under the Key LON1 with all data form that record something like:
{ "Lon1": { "key_1": "25877", "key_2": "321565", "key_3": "0033600000NP8IAAA1", "key_4": "a0436000008XuS2AAK", "key_6": "London", "key_7": "a053600000AiAe5AAF", "key_8": -{ "title": "Public Speaking", "code": "WI2016", "section": "LON1", "Id": "a0436000008XuS2AA2" }, { "key_1": "25877", "key_2": "321565", "key_3": "0033600000NP8IAAA1", "key_4": "a0436000008XuS2AAK", "key_6": "London", "key_7": "a053600000AiAe5AAF", "key_8": -{ "title": "Data", "code": "WI2016", "section": "LON1", "Id": "a0436000008XuS2AA2" } } }, "Lon2": { "key_1": "25877", "key_2": "321565", "key_3": "0033600000NP8IAAA1", "key_4": "a0436000008XuS2AAK", "key_6": "London", "key_7": "a053600000AiAe5AAF", "key_8": -{ "title": "Data 2", "code": "WI2016", "section": "LON2", "Id": "a0436000008XuS2AA2" }, { "key_1": "25877", "key_2": "321565", "key_3": "0033600000NP8IAAA1", "key_4": "a0436000008XuS2AAK", "key_6": "London", "key_7": "a053600000AiAe5AAF", "key_8": -{ "title": "Data 2", "code": "WI2016", "section": "LON2", "Id": "a0436000008XuS2AA2" } } }, },