当前位置:网站首页>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");
}
边栏推荐
- relu与sigmod的比较
- 【上云精品】节能提效!加速纺织业“智造”转型
- 牛客网:分糖果问题
- Detailed explanation of spark specification
- Kingbasees plug-in DBMS of Jincang database_ UTILITY
- 建造者模式
- Spark runs wordcount (case 1)
- 基于C语言的图书信息管理系统 课程论文+代码及可执行exe文件
- A program reflecting the characteristics of C language program structure
- Nacos installation and use
猜你喜欢

Source code analysis of AQS & reentrantlock

Yisheng biological sprint scientific innovation board: 25% of the revenue comes from the sales of new crown products, and it is planned to raise 1.1 billion yuan

Niuke: rotation array

Golden sun education listed in the U.S.: a small cap medium cap stock with a market value of USD 360million

Crawler scheduling framework of scratch+scratch+grammar

Shichuang energy rushes to the scientific innovation board: it plans to raise 1.1 billion yuan, with an annual revenue of 700million yuan and a 36% decrease in net profit

SQL注入漏洞(繞過篇)

How TCP handles exceptions during three handshakes and four waves

龙书虎书鲸书啃不动?试试豆瓣评分9.5的猴书

Dragon Book tiger Book whale Book gnawing? Try the monkey book with Douban score of 9.5
随机推荐
基于超算平台气象预警并行计算架构研究
[维护集群案例集] GaussDB 查询用户空间使用情况
What are the functions of arm64 assembly that need attention?
Presto Web UI introduction
牛客网:旋转数组
Multiple clicks of the button result in results
动态规划解决股票问题(上)
记一次给OpenHarmony提交代码的过程
数据库系列:MySQL索引优化总结(综合版)
Shichuang Energy sprint Technology Innovation Board: le chiffre d'affaires annuel prévu de 1,1 milliard de RMB est de 0,7 milliard de RMB, en baisse de 36%
What is the development history, specific uses and structure of the chip
查询法,中断法实现USART通信
TCP如何處理三次握手和四次揮手期間的异常
SQL注入漏洞(类型篇)
Dynamic programming to solve stock problems (Part 1)
Customize to prevent repeated submission of annotations (using redis)
How to use the markdown editor
ARM64特有一些的汇编指令
Big endian and little endian
Spark runs wordcount (case 1)