当前位置:网站首页>Gson simple to use
Gson simple to use
2022-07-20 21:35:00 【hudawei996】
String jsonParams = "{\"name\":\"goals\" , \"id\":1}";
Map map1 = new Gson().fromJson(jsonParams, Map.class);
System.out.println("name:"+map1.get("name")+",id:"+map1.get("id"));
// Output :name:goals,id:1.0
HashMap map = new HashMap();
map.put("name","david");
map.put("id",2);
String jsonStr = new Gson().toJson(map);
System.out.println(jsonStr);
// Output :{"name":"david","id":2}
边栏推荐
猜你喜欢
随机推荐
Given the preorder traversal and the inorder traversal order of a binary tree, find the postorder traversal of the tree
LeetCode 69:爬楼梯 / 跳台阶
牛客每日刷题之数组
Dest0g3 520迎新赛-web-EasyPHP
基于ssh大学生党建网站系统
2022.07.18 洛谷 P6722 「MCOI-01」Village 村庄
Animation, and basic use of animation
每日牛客刷题之链表
適合送禮的藍牙耳機有哪些?2022藍牙耳機排行榜10强
Redis 日志篇:无畏宕机快速恢复的杀手锏
网络工程案例:CII公司的综合网络设计
你来追我呀!Flutter 实现追逐动画
10000人游戏服务器怎么选?
去做难的工作
干货 | 携程鸿蒙应用开发实践
2022年最新内蒙古建筑安全员模拟题库及答案
【详细教程】一文参透MongoDB聚合查询
Remote login ----- radius authentication
Unity3D学习笔记9——加载纹理
2022 latest Inner Mongolia construction safety officer simulation question bank and answers