FastJSON JSONObject 字段排序 Feature.OrderedField

1package cn.tongdun.robot.web; 2 3import com.alibaba.fastjson.JSON; 4import com.alibaba.fastjson.TypeReference; 5import com.alibaba.fastjson.parser.Feature; 6 7import java.util.List; 8 9/** 10 * @author hello 11 * @date 2019-10-18 13:46 12 * @description 13 */ 14public class Hello { 15 public static void main(String[] args) { 16 String str = "[\n" + 17 " {\n" + 18 " \"type\": \"SEND\",\n" + 19 " \"dataMapping\": {\n" + 20 " \"userid\": \"account\",\n" + 21 " \"ts\": \"ts\",\n" + 22 " \"sign\": \"sign\",\n" + 23 " \"mobile\": \"taskItem.mobile\",\n" + 24 " \"msgcontent\": \"taskItem.content\",\n" + 25 " \"time\": \"taskItem.scheduleTime\",\n" + 26 " \"URL\": \"http://1.1.1.1:8081/api/sms/send\",\n" + 27 " \"password\": \"password\"\n" + 28 " },\n" + 29 " \"maxSendCount\": \"1000\",\n" + 30 " \"tps\": \"50\",\n" + 31 " \"channelPattern\": \"JSON\",\n" + 32 " \"sendSeparate\": \"\",\n" + 33 " \"httpHeaderParams\": {\n" + 34 " \"Authorization\": \"authorization\"\n" + 35 " }\n" + 36 " },\n" + 37 " {\n" + 38 " \"type\": \"REPORT\",\n" + 39 " \"dataMapping\": {\n" + 40 " \"userid\": \"account\",\n" + 41 " \"ts\": \"ts\",\n" + 42 " \"sign\": \"sign\",\n" + 43 " \"password\": \"password\",\n" + 44 " \"URL\": \"http://1.1.1.1/api/v2/sms/query\"\n" + 45 " },\n" + 46 " \"tps\": \"10\",\n" + 47 " \"channelPattern\": \"JSON\"\n" + 48 " }\n" + 49 "]"; 50 51// Object list = JSON.parse(str, Feature.OrderedField); 52 53 List<HelloBean> list = JSON.parseObject(str, new TypeReference<List<HelloBean>>() {}.getType(), Feature.OrderedField); 54 System.out.println(list); 55 } 56} 57 58package cn.tongdun.robot.web; 59 60import com.alibaba.fastjson.JSONObject; 61 62/** 63 * @author hello 64 * @date 2019-10-18 14:29 65 * @description 66 */ 67public class HelloBean { 68 69 /** 70 * type : REPORT 71 * dataMapping : {"userid":"account","ts":"ts","sign":"sign","password":"password","URL":"http://47.99.224.177:8081/api/v2/sms/query"} 72 * tps : 10 73 * channelPattern : JSON 74 */ 75 76 private String type; 77 private JSONObject dataMapping; 78 private String tps; 79 private String channelPattern; 80 81 public String getType() { 82 return type; 83 } 84 85 public void setType(String type) { 86 this.type = type; 87 } 88 89 public JSONObject getDataMapping() { 90 return dataMapping; 91 } 92 93 public void setDataMapping(JSONObject dataMapping) { 94 this.dataMapping = dataMapping; 95 } 96 97 public String getTps() { 98 return tps; 99 } 100 101 public void setTps(String tps) { 102 this.tps = tps; 103 } 104 105 public String getChannelPattern() { 106 return channelPattern; 107 } 108 109 public void setChannelPattern(String channelPattern) { 110 this.channelPattern = channelPattern; 111 } 112}
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

swap空间的增减方法

(1)增大swap空间去激活swap交换区:swapoff v /dev/vg00/lvswap扩展交换lv:lvextend L 10G /dev/vg00/lvswap重新生成swap交换区:mkswap /dev/vg00/lvswap激活新生成的交换区:swapon v /dev/vg00/lvswap