package cn.com.basic.face.util; import cn.com.basic.face.model.ResultMsg; import org.json.JSONException; import org.json.JSONObject; /** * Created by Sinoe on 2017/3/6. */ public class JsonPares { //基础解析 public static ResultMsg getResultMsg(String json) { ResultMsg msg = new ResultMsg(); try { JSONObject object = new JSONObject(json); msg.setCode(object.getInt("code")); msg.setInfo(object.getString("info")); msg.setMessage(object.getString("message")); msg.setTime(object.getLong("time")); } catch (JSONException e) { e.printStackTrace(); } return msg; } }