从SharePoint REST服务返回以下JSON:
{
"d": {
"results": [
{
"__metadata": {
"id": "c7b44ed8-a1fc-44cb-ab36-46aacf1ff992",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(1)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 1,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia California",
"Address": "200 South Matilda Avenue\nW Washington Ave\n94086 Sunnyvale, California\nUnited States of America",
"ID": 1,
"Modified": "2014-02-24T10:06:39Z",
"Created": "2014-02-24T10:06:39Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "d12aafad-502a-4968-a69e-36a7ea05ec80"
},
{
"__metadata": {
"id": "9cc23c9f-5ed3-4717-9e22-9b0ca4d09e05",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(2)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 2,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia Eurasia",
"Address": "Leningradskoe shosse 16a, building 2\n\u041b\u0435\u043d\u0438\u043d\u0433\u0440\u0430\u0434\u0441\u043a\u043e\u0435 \u0448\u043e\u0441\u0441\u0435, 16\u0430, \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 2\nRUSSIA",
"ID": 2,
"Modified": "2014-02-24T10:07:16Z",
"Created": "2014-02-24T10:07:16Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "5aef210c-5590-4633-83b7-3f56902da0ca"
},
{
"__metadata": {
"id": "8366fe34-3a9c-40cc-b62f-08c02f06ae0a",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(3)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 3,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia Latin America",
"Address": "703 NW 62nd Av, Suite 100\nMiami FL, 33126\nUSA",
"ID": 3,
"Modified": "2014-02-24T10:07:53Z",
"Created": "2014-02-24T10:07:53Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "c4e9b03b-1869-423a-9df0-100928020f58"
},
{
"__metadata": {
"id": "aa638997-e55c-4389-9353-ce6911d62441",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(4)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 4,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia Brazil",
"Address": "Av das Nacoes Unidas\n12.901 Torre Norte 11o.\nSao Paulo 04578-910\nBRAZIL",
"ID": 4,
"Modified": "2014-02-24T10:08:22Z",
"Created": "2014-02-24T10:08:22Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "e8525c17-f92c-4b3a-8947-70a8dfd74105"
},
{
"__metadata": {
"id": "32bfc6af-8e16-4956-ab1b-786868ee6225",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(5)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 5,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia Greater China & Korea",
"Address": "Beijing Economic and Technological Development Area\nNo.5 Donghuan Zhonglu\nBeijing, PRC 100176",
"ID": 5,
"Modified": "2014-02-24T10:08:54Z",
"Created": "2014-02-24T10:08:54Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "f1036544-6baf-44a7-9613-fba94edcb18e"
},
{
"__metadata": {
"id": "a53f51b3-fb65-429d-97e9-a175a2111e59",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(6)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 6,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia South East Asia and Pacific",
"Address": "Gateway East\n152 Beach Road\n#20-01\/08\nSingapore 189721",
"ID": 6,
"Modified": "2014-02-24T10:09:30Z",
"Created": "2014-02-24T10:09:30Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "70a6be95-ecfc-45b9-82cd-5a874f4482ae"
},
{
"__metadata": {
"id": "cb2a7a1a-fc2c-409c-a712-6cfa0b7253c8",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(7)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 7,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia India",
"Address": "SP Infocity,\nIndustrial Plot no. 243\nUdyog Vihar, Phase 1,\nDundahera, Gurgaon,\nHaryana - 122016.\nINDIA",
"ID": 7,
"Modified": "2014-02-24T10:10:20Z",
"Created": "2014-02-24T10:10:20Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "24499aae-7659-410f-acd8-899404bbddc8"
},
{
"__metadata": {
"id": "824dc9e9-d958-473b-bde1-4c4e3a48604b",
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)",
"etag": "\"1\"",
"type": "SP.Data.Nokia_x0020_OfficesListItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/File"
}
},
"Folder": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "https:\/\/contoso.sharepoint.com\/_api\/Web\/Lists(guid'c2477113-c582-4c57-bcc6-d4a5ea2e29c9')\/Items(8)\/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 8,
"ContentTypeId": "0x0100BC97B2F575CB0C42B79549F3BABD32A8",
"Title": "Nokia MEA",
"Address": "Al Thuraya Tower II, 27th floor, Dubai Internet City\nDubai, UAE",
"ID": 8,
"Modified": "2014-02-24T10:10:53Z",
"Created": "2014-02-24T10:10:53Z",
"AuthorId": 12,
"EditorId": 12,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "ba897f84-ccbb-4938-a6ce-b9705d3d3a63"
}
]
}
}
并以字符串形式保存到名为$data
尝试使用ConvertFrom-Json cmdlet将JSON格式的字符串转换为自定义对象:
$results = $data | ConvertFrom-Json
给出以下错误:
ConvertFrom-Json:无法转换JSON字符串,因为字典 从字符串转换而来的是包含重复键'Id' 和'ID'。
有没有办法在PowerShell中转换指定的JSON格式的字符串?
答案 0 :(得分:8)
这就是我用它做的事情:
$results = $data.ToString().Replace("ID", "_ID") | ConvertFrom-Json
答案 1 :(得分:3)
ConvertFrom-JSON它将尝试从JSON字符串创建PS自定义对象。 PowerShell对象属性名称不区分大小写,因此“ID”和“id”表示相同的属性名称。在尝试进行转换之前,您将不得不在JSON中对这些重复的属性名称执行某些操作,否则它将失败。
答案 2 :(得分:3)
在PowerShell V1.0或PowerShell V2.0中,当JSON太大时,我仍然使用转换为XML:
Add-Type -AssemblyName System.ServiceModel.Web, System.Runtime.Serialization
function Convert-JsonToXml
{
PARAM([Parameter(ValueFromPipeline=$true)][string[]]$json)
BEGIN
{
$mStream = New-Object System.IO.MemoryStream
}
PROCESS
{
$json | Write-String -stream $mStream
}
END
{
$mStream.Position = 0
try
{
$jsonReader = [System.Runtime.Serialization.Json.JsonReaderWriterFactory]::CreateJsonReader($mStream,[System.Xml.XmlDictionaryReaderQuotas]::Max)
$xml = New-Object Xml.XmlDocument
$xml.Load($jsonReader)
$xml
}
finally
{
$jsonReader.Close()
$mStream.Dispose()
}
}
}
使用此代码,您可以循环浏览您可以测试的项目:
$a = Get-Content C:\temp\jsontest.txt
$b.root.d.results.Item
$b.root.d.results.Item[7].Id[0].InnerText
(编辑)的
在你的情况下,我只会替换预期的重复ID / Id
$data = Get-Content C:\temp\jsontest.txt -Raw
$datacorrected = $a -creplace '"Id":','"Id-minus":'
$psJsonIn = $datacorrected | ConvertFrom-Json
如果您真的遇到意外重复,可以编写一个函数来捕获由于重复密钥导致的转换错误并替换掉一个。