Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4802

ConvertFrom-Json : Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys

$
0
0

The following JSON is getting returned from OData API service:

{"d": {"results": [      {"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"      }    ]  }}

and saved as a string into variable named $data

An attempt to convert a JSON-formatted string to a custom object using ConvertFrom-Json cmdlet:

$results = $data | ConvertFrom-Json

gives the following error:

ConvertFrom-Json : Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'Id' and 'ID'.

Is there any way to convert the specified JSON-formatted string in PowerShell?


Viewing all articles
Browse latest Browse all 4802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>