fastjson list转json

1,内容是字符串

String json = JSON. toJSONString(list);

结果:["111" ,"222"]

2,内容是时间

SerializeConfig config = new SerializeConfig();

config. put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));

String json = JSON. toJSONString(list, config);

System. out. println(json);

结果:["2022-11-05 11:23:22" ," 2022-11-05 11 :23:22"]

3,内容是对象

List students = new ArrayList<>();

String json = JSON.toJSONString(students);

结果:【{111},{222}】

相关推荐
莫叫石榴姐1 小时前
ast 在 Dify 工作流中解析 JSON 格式数据的深度解析
大数据·网络·安全·json
GDAL2 小时前
express.json 深入全面讲解教程
json·express
武藤一雄3 小时前
彻底吃透.NET中序列化反序列化
xml·微软·c#·json·.net·.netcore
liangshanbo12154 小时前
JSON-RPC 2.0 协议详解
网络协议·rpc·json
elangyipi1231 天前
深入理解前端项目中的 package.json 和 package-lock.json
前端·json
雪域迷影1 天前
Windows11中VS2026使用C++ 现代化json库nlohmann的3种方式
开发语言·c++·json
雪域迷影1 天前
nlohmann::json库对象和json结构体转换的新方式
c++·json·nlohmann_json库
生产队队长2 天前
Web:免费的JSON接口
json
Honmaple2 天前
中国四级城市联动数据,包含港澳台,内含json , sql , python 脚本
python·sql·json
慧都小项2 天前
Parasoft Jtest 如何用 JSON 文件驱动Java 测试自动化
java·自动化·json