zoukankan      html  css  js  c++  java
  • 将json转为 SortedDictionary

     #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
  • 相关阅读:
    java int转byte数组
    业务网关-操作手册
    业务网关-配置
    H2数据库的导入、导出(CSV)
    sequelize踩坑处理:时间格式化
    引入koa-static处理静态资源
    MySql利用case when实现批量更新多条记录的不同值实现方法
    Sequelize增删改查及批量新增或批量更新(bulkCreate的updateOnDuplicate)等常用接口
    数据结构队列、双端队列、队列系算法题解析
    配置webpack中externals来减少打包后vendor.js的体积
  • 原文地址:https://www.cnblogs.com/wang-123/p/7017196.html
Copyright © 2011-2022 走看看