1. 对象转换成json字符串:
JSONObject.toJSONString(switchmes)
2. JSON字符串转换成对象:
Switchmes switchmes=(Switchmes) JSONObject.parseObject(bd.getBdmes(),Switchmes.class); Switchmes是对象,bd.getBdmes()是json字符串,
根据实际情况进行修改。
主要使用了import com.alibaba.fastjson.JSONObject;