How can group data in the object, which would result in the 2nd version.
The data returned by the web api can be changed - it obviously binds to the key will not work.
Below is the format of what is now:
var obj = {
"0": {
"@odata.etag": "W/\"1240107\"",
"statecode_FormattedValue": "Open",
"statecode": 0,
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
"activityid": "cb857c42-951e-e711-80d3-00155d0e443f",
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
},
"1": {
"@odata.etag": "W/\"1240171\"",
"statecode_FormattedValue": "Open",
"statecode": 0,
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
"activityid": "374a8d72-4b39-e711-80d5-00155d0e443f",
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
},
"2": {
"@odata.etag": "W/\"1224371\"",
"statecode_FormattedValue": "Open",
"statecode": 0,
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
"activityid": "f31ad69a-5339-e711-80d5-00155d0e443f",
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
},
"3": {
"@odata.etag": "W/\"1224547\"",
"statecode_FormattedValue": "Open",
"statecode": 0,
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
"activityid": "6bee97d8-7939-e711-80d5-00155d0e443f",
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
}
}
And the format you need to get:
var obj1 = {
"0": {
"@odata.etag": "W/\"1240107\"",
"statecode": {
"statecode_FormattedValue": "Open",
"statecode": 0,
},
"prioritycode": {
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
},
"activityid": "cb857c42-951e-e711-80d3-00155d0e443f",
"_createdby_": {
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
}
},
"1": {
"@odata.etag": "W/\"1240171\"",
"statecode": {
"statecode_FormattedValue": "Open",
"statecode": 0,
},
"prioritycode": {
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
},
"activityid": "374a8d72-4b39-e711-80d5-00155d0e443f",
"_createdby_": {
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
}
},
"2": {
"@odata.etag": "W/\"1224371\"",
"statecode": {
"statecode_FormattedValue": "Open",
"statecode": 0,
},
"prioritycode": {
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
},
"activityid": "f31ad69a-5339-e711-80d5-00155d0e443f",
"_createdby_": {
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
}
},
"3": {
"@odata.etag": "W/\"1224547\"",
"statecode": {
"statecode_FormattedValue": "Open",
"statecode": 0,
},
"prioritycode": {
"prioritycode_FormattedValue": "Normal",
"prioritycode": 1,
},
"activityid": "6bee97d8-7939-e711-80d5-00155d0e443f",
"_createdby_": {
"_createdby_value_LogicalName": "systemuser",
"_createdby_value_FormattedValue": "User1",
"_createdby_value": "ea06239e-3918-e711-80d3-00155d0e443f"
}
}
}