惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
博客园_首页
Vercel News
Vercel News
WordPress大学
WordPress大学
美团技术团队
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Y
Y Combinator Blog
博客园 - 【当耐特】
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
腾讯CDC
M
MIT News - Artificial intelligence
爱范儿
爱范儿
Recent Announcements
Recent Announcements
雷峰网
雷峰网
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
The Register - Security
The Register - Security
Jina AI
Jina AI
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
P
Privacy & Cybersecurity Law Blog
Recorded Future
Recorded Future
Help Net Security
Help Net Security
N
News and Events Feed by Topic
博客园 - Franky
P
Proofpoint News Feed
L
LINUX DO - 热门话题
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
D
Docker
Google DeepMind News
Google DeepMind News
有赞技术团队
有赞技术团队
IT之家
IT之家
Security Latest
Security Latest
L
LangChain Blog
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks

MakeItClear

Fish Shell 设置 python3 为默认版本 Homebrew 安装及更新软件 | MakeItClear Mac 安装配置Mysql | MakeItClear Mac 安装配置 Miniconda | MakeItClear Hyper & Fish Shell | MakeItClear Mac 终端提示: The default interactive shell is now zsh. Chrome 内置二维码功能 | MakeItClear Chrome 优秀插件推荐「持续更新」 | MakeItClear Mac 免费效率软件推荐「持续更新」 | MakeItClear
FastJson 对象、JSON、字符串、Map 之间的互转 | MakeItClear
2021-03-02 · via MakeItClear
  1. 对象与字符串之间的互转
// 将对象转换成为字符串
String str = JSON.toJSONString(infoDo);
// 字符串转换成为对象
InfoDo infoDo = JSON.parseObject(strInfoDo, InfoDo.class);
  1. 对象集合与字符串之间的互转
// 将对象集合转换成为字符串
String users = JSON.toJSONString(users);
// 将字符串转换成为对象集合
List<User> userList = JSON.parseArray(userStr, User.class); 
  1. 字符串互转JSONObject
// String 转 Json对象
JSONObject jsonObject = JSONObject.parseObject(jsonString);
// json对象转string
JSONObject jsonObject = JSONObject.parseObject(str);//json对象转字符串 
String jsonString = jsonObject.toJSONString();
  1. map与字符串之间互转
//字符串转map
JSONObject  jsonObject = JSONObject.parseObject(str);
Map<String,Object> map = (Map<String,Object>)jsonObject;//    //json对象转Map
//map转字符串
String jsonString = JSON.toJSONString(map);
  1. Map 转 Json对象
//map转json对象    
Map<String,Object> map = new HashMap<>();
map.put("age", 24);
map.put("name", "cool_summer_moon");
JSONObject json = new JSONObject(map);  
//json对象转Map   
Map<String,Object> map = (Map<String,Object>)jsonObject;