I am using NewtonSoft Jason.net, to distinguish Jason feeds into objects: < P> Jason:
staticKey1: value, staticKey2: value, result: [{key1: value1, key2: value2, key3: value3, ... keyN: valueN}], C # class:
public class MyClassName {public string staticKey1 {get; Set; } Public string staticKey2 {get; Set; } Public Dictionary & lt; String, string & gt; Results {get; Set; }} I'm using Newtonsoft.Json.JsonConvert.DeserializeObject (), but I'm getting an exception:
to the existing JSON array Can not deserialize (like [1,2,3]) type in the type 'System.Collections.Generic.Dictionary`2 [System.String, System.String]' 'because this type requires a JSON object (eg {"Name": "value"}) To properly deerialize this error, either convert JSON into a JSON object (such as {"name": "value"}) or an array or a Such type of And implement a collection interface (such as Icling, ILIST), such that the list can be deserialized from a JSON array, JsonArrayAttribute can also be added to force it to deserialize from a JSON array.
In fact its easy to use:
public Square micholas {public string staticKey1 {get; Set; } Public string staticKey2 {get; Set; } Public IEnumerable & lt; IDictionary & lt; String, string & gt; & Gt; Results {get; Set; }} But there is probably a better solution.
No comments:
Post a Comment