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

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

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