当前位置:网站首页>JSON format processing
JSON format processing
2022-06-25 11:40:00 【Duxiaolie】
json Format requirements :
{
"app": "apps",
"type": "operate",
"data": [{
"time": 1478055271575,
"user_id": "450000",
"username": " Duxiaolie "
}]
}
Java Code Splicing :
Map<String,String> map = new HashMap<>{
};
List<Event_CM> eventList = isServiceMapper.selectUser();
// Not much data can be found , Directly joining together
map.put("app", "apps");
map.put("type", "operate");
map.put("data", eventList);
// Convert to json
String paramJson = mapper.writeValueAsString(map);
remarks : Don't read the following .
If you find eventList Too much , Need to cut .
Map<String,String> map = new HashMap<>{
};
List<Event_CM> eventList = isServiceMapper.selectUser();
List<List<Event_CMVo>> eventBatchList = null;
// Cutting method (splitList() The method of company encapsulation )
eventBatchList = splitList(event_cmVoList, 100);
for (List<Event_CMVo> eventBatch : eventBatchList) {
map.put("app", "apps");
map.put("type", "operate");
map.put("data", eventBatch);
String paramJson = mapper.writeValueAsString(map);
// send out http agreement .( Company encapsulated interfaces )
/** * Parameter one : The goal is URL * Parameter two : As a substitute URL( The goal is URL When it's empty , Use substitute URL) * Parameter 3 : Parameters sent * Parameter 4 : type */
String resultJson = CloseableHttpClientNewUtil.postJson(Configuration.get().getString("EventCM_URL", "http://xx.xxx.xx.79:8080"), paramJson, "UTF-8");
}
边栏推荐
- 西山科技冲刺科创板:拟募资6.6亿 郭毅军夫妇有60%表决权
- Solution to the timeout scenario of Flink streaming computing (official live broadcast)
- Sentinel integrated Nacos data source
- 按钮多次点击造成结果
- Niuke: rotation array
- Openfeign uses
- Handler、Message、Looper、MessageQueue
- Comparator(用于Arrays.sort)
- 记一次有趣的逻辑SRC挖掘
- Xishan technology rushes to the scientific innovation board: it plans to raise 660million yuan. Guoyijun and his wife have 60% of the voting rights
猜你喜欢

Design and implementation of university laboratory goods management information system based on SSH

芯片的发展史和具体用途以及结构是什么样的

CMU提出NLP新范式—重构预训练,高考英语交出134高分

Comment TCP gère - t - il les exceptions lors de trois poignées de main et de quatre vagues?

時創能源沖刺科創板:擬募資11億 年營收7億淨利反降36%

Detailed explanation of spark specification

CFCA Anxin sign access

Redis6笔记02 配置文件,发布和订阅,新数据类型,Jedis操作

SQL injection vulnerability (bypass)

Crawler scheduling framework of scratch+scratch+grammar
随机推荐
元素定位不到的 9 种情况
How to use the markdown editor
Research on parallel computing architecture of meteorological early warning based on supercomputing platform
Free access to the global human settlements layer (ghsl) dataset from Gee
Under what circumstances will Flink combine operator chains to form operator chains?
PHP如何提取字符串中的图片地址
Gaussdb others scenarios with high memory
Keywords serializable serialization and deserialization
Course paper + code and executable EXE file of library information management system based on C language
推荐一款M1电脑可用的虚拟机软件
牛客网:分糖果问题
時創能源沖刺科創板:擬募資11億 年營收7億淨利反降36%
Very important very important very important very important very important very important very important very important very important
GaussDB 集群维护案例集-sql执行慢
Subclass a inherits from parent class B, a a = new a(); Then the execution sequence of the constructor of parent class B, the static code block of parent class B, the non static code block of parent c
redis的dict的扩容机制(rehash)
Spannable and editable, spannablestring and spannablestring
Detailed explanation of Spark's support source code for Yan priority
时创能源冲刺科创板:拟募资11亿 年营收7亿净利反降36%
Niuke: rotation array