Java 生成和解析json请求的最简单方法

Java 生成和解析json请求的最简单方法,java,android,json,web,android-json,Java,Android,Json,Web,Android Json,我需要使用JSON api,但不知道如何使用。我找到的所有教程都是关于从文件解析json的 我需要提出这样的请求: 然后它会返回这个 {"status": "OK", "end_url": "http://www.systemcomic.com/2011/06/27/the-system-506-office-forecast/", "redirects": 3, "urls": ["http://t.co/gLP0Ucg", "http://www.notquitewrong.com/ross

我需要使用JSON api,但不知道如何使用。我找到的所有教程都是关于从文件解析json的

我需要提出这样的请求:

然后它会返回这个

{"status": "OK", "end_url": "http://www.systemcomic.com/2011/06/27/the-system-506-office-forecast/", "redirects": 3, "urls": ["http://t.co/gLP0Ucg", "http://www.notquitewrong.com/rosscottinc/2011/06/27/the-system-506-office-forecast/", "http://www.systemcomic.com//2011/06/27/the-system-506-office-forecast/", "http://www.systemcomic.com/2011/06/27/the-system-506-office-forecast/"], "start_url": "http://t.co/gLP0Ucg"}

我只需要结束url字符串。我该怎么做?我还将在一个异步任务中执行此操作

以获取
JSON
,您需要使用http请求提取它,然后在获得响应后解析它以获取
end\u url

尝试此操作以解析
结束\u url

final Pattern pattern = Pattern.compile("\"end_url\": \"(.+?)\",");
final Matcher matcher = pattern.matcher(You_json_string);
matcher.find();
Log.d("end_url" , matcher.group(1));

阅读这篇关于如何在android上发出HTTP请求的文章:@ShivamVerma,这在任何方面对我都没有帮助。我不想发出http请求,我想发出json请求,然后解析它。您是否已经保存了json字符串?您是否能够成功检索它?