#region ConvertJsonToSortedDictionary 将json转为 SortedDictionary
        /// <summary>
        /// 将json转为 SortedDictionary
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public static ReturnValue ConvertJsonToSortedDictionary(string json)
        {
            ReturnValue retValue = new ReturnValue();
            if (string.IsNullOrEmpty(json))
            {
                retValue.HasError = true;
                retValue.Message = "json数据为空";

                return retValue;
            }
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            try
            {
                SortedDictionary<string, object> sortDict = new SortedDictionary<string, object>(javaScriptSerializer.Deserialize<SortedDictionary<string, object>>(json));

                retValue.HasError = false;
                retValue.ReturnObject = sortDict;
                return retValue;
            }
            catch (Exception ex)
            {
                retValue.HasError = true;
                retValue.Message = "数据转换出错";
                retValue.InnerMessage = ex.Message;

                log.WarnFormat("ConvertJsonToSortedDictionary   json={0} 出错,原因:{1}", json, ex.Message);
                return retValue;
            }
        }
        #endregion

相关文章:

  • 2022-01-26
  • 2022-03-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-23
  • 2022-01-06
  • 2022-01-18
相关资源
相似解决方案