日期:2014-05-16  浏览次数:20570 次

Json依赖包 JSONObject
renren-wap-framework-logic
Json依赖包 JSONObject
jsonrpc-1.0.0.jar

import java.text.ParseException;

import org.json.JSONObject;


/**
 * $Id$
 * Copyright 2009-2010 Oak Pacific Interactive. All rights reserved.
 */

/**
 * 
 * @author <a href="mailto:qiao.wang@renren-inc.com">王侨</a>
 * @createTime 2011-7-20下午01:34:01
 */
public class Test {

	/**
	 * @param args
	 * @throws ParseException 
	 */
	public static void main(String[] args) throws ParseException {
		System.out.print("123");
		String str = "{name:'图片1',url:'http://www.renren.com/testiphone1.html', displayOrder:1}," +
		"{name:'图片2',url:'http://www.renren.com/testiphone2.html', displayOrder:2}," + 
		"{name:'图片3',url:'http://www.renren.com/testiphone3.html', displayOrder:3}";
		System.out.println("sna"+ str);
		
		JSONObject jsonObject = new JSONObject(str);
        //取属性值
        String name = jsonObject.getString("name");
        String url = jsonObject.getString("url");
        int displayOrder = jsonObject.getInt("displayOrder");
        //设置model
        System.out.print(name+ " ");
        System.out.print(url + " ");
        System.out.print(displayOrder);
        
	}

}