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
Post a Comment