1 Star 0 Fork 17

xiaohaozi / Flink_Code

forked from Appleyuchi / Flink_Code 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Json_String_List_User.java 768 Bytes
一键复制 编辑 原始数据 按行查看 历史
fastsource 提交于 2021-01-20 21:10 . 整理
import com.alibaba.fastjson.JSON;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
public class Json_String_List_User {
public static void main(String[] args) throws FileNotFoundException, IOException {
//---------------------------json字符串 -> List<User>对象------------------------
/*
* 字符串:[{"password":"123123","username":"zhangsan"
* },{"password":"321321","username":"lisi"}]
*/
String jsonStr2 = "[{'password':'123123','username':'zhangsan'},{'password':'321321','username':'lisi'}]";
List<User> users = JSON.parseArray(jsonStr2, User.class);
System.out.println("json字符串转List<Object>对象:" + users.toString());
}
}
1
https://gitee.com/haozilovecat/Flink_Code.git
git@gitee.com:haozilovecat/Flink_Code.git
haozilovecat
Flink_Code
Flink_Code
master

搜索帮助