using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Linq; /// /// json工具集 /// public partial class Utils { /// /// 检测json对象中是否有指定的key /// /// Json对象 /// key名称 /// 有true, 没有false public static bool HasJsonKey(JObject obj, string key) { foreach (KeyValuePair kv in obj) { if (kv.Key == key) { return true; } } return false; } }