1. java自带的原生sf.json

json字符串转对象

import net.sf.json.JSONObject

String response="{\"status\":\"error\",\"message\":\"没有选中文件!\"}";
JSONObject jsonObject=JSONObject.fromObject(response);
	String documentId=(String) jsonObject.get("message");

JSONObject jsonObject = new JSONObject(JSON字符串);

2.阿里巴巴的fastjson

json字符串转对象

import com.alibaba.fastjson.JSON

		HashMap al = (HashMap)JSON.parseObject(JSON字符串,HashMap.class);
		PersonalVo user = (PersonalVo)JSON.parseObject(JSON字符串,PersonalVo.class);
		List<类型> list=JSON.parseArray(JSON字符串,类型.class);

对象转json字符串

String json=JSON.toJSONString(要转换的对象)

3.Gson解析

json字符串转对象

Student stu = new Gson().fromJson(json, Student.class);

对象转json字符串

String json = new Gson().toJson(对象)

4.JackJson解析

json字符串转对象

Student stu = new ObjectMapper().readValue(json字符串, Student .class);