c# - JSON.NET won't deserialize into my object, throws an exception -
my json (mystring) looks this:
"http://d.opencalais.com/dochash-1/0701d73f-2f99-39e1-8c29-e61ee8bf3238/cat/1": { "_typegroup": "topics", "category": "http://d.opencalais.com/cat/calais/law_crime", "classifiername": "calais", "categoryname": "law_crime", "score": 0.869 }
i trying deserialise above exact string object:
public class opencalaisresult { public string _typegroup {get; set; } public string category { get; set; } public string categoryname { get; set; } public string classifiername { get; set; } public decimal score { get; set; } }
i trying code:
opencalaisresult myobject = (opencalaisresult)jsonconvert.deserializeobject(mystring, typeof(opencalaisresult), settings);
i exception:
{"error converting value \"http://d.opencalais.com/dochash-1/0701d73f-2f99-39e1-8c29-e61ee8bf3238/cat/1\" type 'myapp.parsers.jsontypes.opencalaisresult'. path '', line 1, position 78."}
any idea doing wrong?
your json should
{ "http://d.opencalais.com/dochash-1/0701d73f-2f99-39e1-8c29-e61ee8bf3238/cat/1": { "_typegroup": "topics", "category": "http://d.opencalais.com/cat/calais/law_crime", "classifiername": "calais", "categoryname": "law_crime", "score": 0.869 } }
Comments
Post a Comment