JSONObject
发布时间:2020-12-16 19:45:47 所属栏目:百科 来源:网络整理
导读:public class TestInfo { public static JSONObject createJSONObject() throws Exception { JSONObject jsonObject = new JSONObject(); //创建JSONObject对象 jsonObject.put("name","yangbin"); jsonObject.put("age",new Integer(100)); return jsonObje
public class TestInfo { public static JSONObject createJSONObject() throws Exception { JSONObject jsonObject = new JSONObject(); //创建JSONObject对象 jsonObject.put("name","yangbin"); jsonObject.put("age",new Integer(100)); return jsonObject; } public static void main(String[] args) throws Exception { JSONObject jsonObject = TestInfo.createJSONObject(); //输出jsonobject对象 String name = (String)jsonObject.get("name"); System.out.println("jsonObject==>"+name); } }
JSONObject 是有一个KEY 跟value的。他通过KEY 来传值! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |