json对象

"RequestHeaders": {
"Host": "tool.kkbmtj.com",
"Referer": "https://m.kkbmtj.com/ys/shortindex?origin=kktj&xcx",
}

代码:

    HeaderLog headerLog = new HeaderLog();

    var Headerobj = (JObject)JsonConvert.DeserializeObject(RequestHeaders);

    headerLog.Host = Headerobj["Host"].ToString();

    headerLog.Referer = Headerobj["Referer"].ToString();

    headerLog.Origin = Headerobj["Origin"].ToString(); 

修改为:  headerLog.Origin = Headerobj.Value<string>("Origin");

 

提示报错      

    System.NullReferenceException:“未将对象引用设置到对象的实例。”

    Newtonsoft.Json.Linq.JObject.this[string].get 返回 null。