Map格式-joson格式

mapStr:

{CHAR=UTF-8, DATA=eyJNRVJDSEFOVCI6IjEwMDEiLCJWRVJTSU9OIjoiMS4wLjAiLCJUUkFERSI6IjIwMTgwNjEyMTY1NSIsIlRZUEUiOiJRIn0=, SIGN=5b99ce3dc8ed002fc5aa10800cae221a}

 

jsonStr:

{"MERCHANT":"1001","VERSION":"1.0.0","TRADE":"201806121655","TYPE":"Q"}

 

例子:

Map<String,String> settleInfo = new HashMap<>();
settleInfo.put("merchantId","merchNo");
settleInfo.put("merchantName","商城");
settleInfo.put("orderAmt", "0.01");
settleInfo.put("sumGoodsName","商城");
System.out.println("settleInfo = "+settleInfo);
List<Map<String,String>> settle = new ArrayList<>();
settle.add(settleInfo);
System.out.println("settle = "+settle);
System.out.println("JsonUtils.toJson(settle) = "+ JsonUtils.toJson(settle));

结果:

settleInfo = {sumGoodsName=裕福商城, merchantId=merchNo, orderAmt=0.01, merchantName=裕福商城}
settle = [{sumGoodsName=裕福商城, merchantId=merchNo, orderAmt=0.01, merchantName=裕福商城}]
JsonUtils.toJson(settle) = [{"sumGoodsName":"裕福商城","merchantId":"merchNo","orderAmt":"0.01","merchantName":"裕福商城"}]

 

posted @ 2018-06-13 11:12  盟约  阅读(5003)  评论(0编辑  收藏  举报