12345678910111213141516171819202122 |
- using System;
- using System.Collections.Generic;
- using LitJson;
- namespace MySystem
- {
- public static class JsonDataExtension
- {
-
- #region 获取是否存在Key, isFlag判断是抛出异常还是返回""
- public static object getItem(this JsonData input, string key)
- {
- string jsonString = input.ToJson();
- if(jsonString.Contains("\"" + key + "\""))
- {
- return input[key];
- }
- return "";
- }
- #endregion
- }
- }
|