JArray & JObject
JArray与JObject在json的应用:无需定义相应的类对象,直接解析
JArray jarr = JArray.Parse(jsonStr); //数组json串
for (var i = 0; i < jarr.Count; i++) {
JObject jobj = JObject.Parse(jarr[i].ToString());
}
若是非数组json串,用var jobj = JObject.Parse(jsonStr);
即可
JObject & JToken
判断键值是否存在
JObject:obj.Property(_key) == null || string.isNullOrWhitespace( obj.Property(_key).ToString() )
JToken:string.isNullOrWhitespace( obj..Value<string>(_key) )