java 对象转json json转对象
import com.alibaba.fastjson.JSON;
/**
*
* @title: fastjson
* @author: wll
* @since: 2021-5-19 13:47:40
*/
public class TestJson {
public static void main(String[] args) {
String Json="{}";
//json转对象
Xxxx parseObject = JSON.parseObject(Json, Xxxx.class);
//对象转json
String jsonString = JSON.toJSONString(parseObject);
}
}