xuxiuxi
2017-03-29 386839ed53a6ede6994ecf34c800eebf3e3c1ef9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
    }
}