public static JSONObject jsonTest()
{
JSONObject jsonObject = null;
JSONObject userCommentJson = null;
JSONArray data = new JSONArray();
try{
for (int i = 0; i < 10; i++) {
userCommentJson = new JSONObject();
userCommentJson.put("userContent", "说的好");
userCommentJson.put("replyUserName", "普京");
userCommentJson.put("replyUserId", "10");
userCommentJson.put("replyCommentId", "2");
userCommentJson.put("goodNum", "499");
userCommentJson.put("userToken", "1");
userCommentJson.put("userCodeId", "1(腾讯qq)");
userCommentJson.put("userHead", "");
userCommentJson.put("userCity", "深圳");
data.put(userCommentJson);
}
jsonObject = new JSONObject();
jsonObject.put("state", "1");
jsonObject.put("data", data);
}catch(JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return jsonObject;
}
生成json数据示例
最新推荐文章于 2019-09-02 22:02:07 发布