c# - Newtonsoft.Json Custom Root Name for Deserialization -


i have class defines json format:

public class resulttype {     public bool status { get; set; }     public string message { get; set; } } 

the actual json looks this:

{"result":{"status":true,"message":"success"}} 

how can override root attribute when de-serializing json "result"

jobject jsonresponse = jobject.parse(jsonstring); resulttype _data = newtonsoft.json.jsonconvert.deserializeobject<resulttype>(jsonresponse["result"].tostring());  console.writeline(_data.status); 

fiddle: https://dotnetfiddle.net/gjys2p


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -