1. 程式人生 > >java JSONObject轉換為String格式

java JSONObject轉換為String格式

在使用微信支付時,需將從前臺接收的JSONObeject 格式資料轉換為String型別,其具體的轉換過程如下:

 

JSONObject jsonObject = JSONObject.parseObject(XmltoJsonUtil.xml2JSON(content));
JSONObject result_xml = jsonObject.getJSONObject("xml");
JSONArray result_code = result_xml.getJSONArray("result_code");
String code = (String) result_code.get(0);
System.out.println("回撥code:activityNotify" + code);