参考前文在Java项目中引入FastJson
实现Json字符串提取键值:
String json = httpContent.content().toString(0, httpContent.content().capacity(),
Charset.defaultCharset()); //从Http消息中读取服务器返回的Json字符串
JSONObject obj = JSON.parseObject(json); //将Json字符串转化为Json对象
String status = (String) obj.get("status");//从Json对象中提取键值为“status”的键值对,并将键值保存在“status”字符串中