zoukankan      html  css  js  c++  java
  • Json转化

        public static PromoteActivityExt getExtByActivityDO(ActivityDO activityDO){
            if(null==activityDO){
                return null;
            }
            PromoteActivityExt activityExt = JSON.parseObject(activityDO.getFeature(), PromoteActivityExt.class);
            return activityExt;
        }

    2、转列表:

      List<ProjectRestDTO> list = JSONObject.parseArray(getlowestPriceStr(), ProjectRestDTO.class);
            System.out.println(list.toString());

    3、HashMap: json 转HashMap

     String operationParam = detailDO.getOperationParam();
                    HashMap<String,String> hashMap = JSON.parseObject(operationParam, HashMap.class);
                    String discountValue = hashMap.get(OperationParamEnum.DISCOUNT_VALUE.getKey());
                    String brokerageRate = hashMap.get(OperationParamEnum.BROKERAGE_RATE.getKey());
                    channelInfo.setDiscount(Double.valueOf(discountValue));
                    channelInfo.setBrokerageRate(Integer.valueOf(brokerageRate));

     HashMap转json转化:

     Map paramMap = new HashMap();
                paramMap.put(OperationParamEnum.DISCOUNT_VALUE.getKey(),String.valueOf(channelInfo.getDiscount()));
                paramMap.put(OperationParamEnum.BROKERAGE_RATE.getKey(),String.valueOf(channelInfo.getBrokerageRate()));
                activityDetailDO.setOperationParam(JSON.toJSONString(paramMap));
  • 相关阅读:
    string
    auto和decltype
    const限定符
    &(引用) 和 *(指针)
    extern关键字
    关于将函数写入头文件问题(分离式编译)
    poj2154(polya定理+欧拉函数)
    bzoj2115(线性基)
    51nod1832(二叉树/高精度模板+dfs)
    51nod1464(trie + dfs)
  • 原文地址:https://www.cnblogs.com/aspirant/p/12516389.html
Copyright © 2011-2022 走看看