JsonConvert.DeserializeObject() returns error

问题内容:

I have a JSON file. When I call JsonConvert.DeserializeObject(), it returns the following error:

Newtonsoft.Json.JsonReaderException: Unexpected character encountered
while parsing value: {. Path ‘Content’, line 2, position 14.

Here is the JSON file:

{
  "Content": {
     "Results": [
        {
           "Id": "a4102380-b545-4308-849a-8c2bc2efc966",
           "SerialNumber": "E10001",
           "MyId": "a8333a9e-ed5b-4aa0-b8b7-113a3fbcfd93",
           "CreatedDateTimeUtc": "2017-12-07T00:00:00",
           "FeatureKey": 256,
           "FeatureName": "MyFeatureName",
           "ExpectedVersion": "V10001",
           "ActualVersion": "V20002"
        }
     ],
     "TotalCount": 2
  },
  "StatusCode": 200
}

问题评论:

    
Which language are you using? C#? Are you using the .NET platform?
    
Try by adding above json inside ‘[‘ and ‘]’..
    
Yes i am using C# and .NET platform
– Vishcp
4 hours ago
    
saw your class structure
    
Throws no exception for me. Using latest Newtonsoft.Json version. What parameters do you pass to DeserializeObject?

原文地址:

https://stackoverflow.com/questions/47752315/jsonconvert-deserializeobject-returns-error

Tags:,

添加评论

友情链接:蝴蝶教程