1. js
对象转json : JSON.stringify()
json转对象: JSON.parse()
2.Java
json转对象 :
import com.alibaba.fastjson.JSONObject;
//将字符换 转化为JSONObject 对象
JSONObject jsonObject = JSONObject.parseObject(message);
// 获取json对象中的内容
String key= jsonObject.getString("key");
对象转json:
import com.alibaba.fastjson.JSON;
JSON.toJSONString(对象)