IT序号网

JAVA 取Json字符串 里面值

flyfish 2021年06月13日 编程语言 287 0



import net.sf.json.JSONObject; 
 
public class TJsonTest { 
 
	/** 
	 * @param args 
	 */ 
	public static void main(String[] args)  throws Exception { 
		 
		String  requestStr="{\"access_token\":\"MoSu_b2aV8-iYau52meGQEZfYVfrOH5ejeEyRRzUu2YHKw94RKK3QeCLcZGXTTqJ\",\"expires_in\":7200}"; 
		 
		JSONObject jsonObject =  JSONObject.fromObject(requestStr);  
		System.out.println(jsonObject.getString("access_token")); 
		 
 
	} 
 
}



评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!