Json,Object互相转换

import com.alibaba.fastjson.JSONObject;

Object,List<Object>转JsonStr
String jsonString = JSONObject.toJSONString(object);

JsonStr转JSONObject
JSONObject jSONObject = JSONObject.parseObject(jsonStr);

JsonStr转Object
BeanName beanName = SONObject.parseObject(beanJsonStr, BeanName.class);

JsonStr转List<Object>
List<BeanName> parseArray = JSONObject.parseArray(beanJsonStr, BeanName.class);

Json,Object互相转换

上一篇:jquery的事件对象、原对象的属性方法和阻止冒泡事件


下一篇:Ubuntu20.04 TLS 开机卡“A start job is running for wait for network to be Configured”的解决方法