如何通过调用Android的一个JSON web服务 [英] How to call a json webservice through android

查看:118
本文介绍了如何通过调用Android的一个JSON web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用JSON来访问.NET Web服务在休息的格式。我米 pretty的新这一概念,并十分困惑如何 作品.... 任何一个谁可以给这样的一个概况。我所需要的步骤,我 需要按照使用JSON。现在我的疑问是如何使用JSON来 抢输出。

I need to access a .Net web service in Rest format using JSON. I m pretty new to this concept and very much confused about how this works.... Any one who can give an overview of this. I need the steps that I need to follow to use JSON. Right now my doubt is how to use JSON to grab to output.

推荐答案

这是解析的Json 网​​络役

    String str="url";
    try{
        URL url=new URL(str);
        URLConnection urlc=url.openConnection();
        BufferedReader bfr=new BufferedReader(new InputStreamReader(urlc.getInputStream()));
        String line;
        while((line=bfr.readLine())!=null)
        {
        JSONArray jsa=new JSONArray(line);
        for(int i=0;i<jsa.length();i++)
           {
           JSONObject jo=(JSONObject)jsa.get(i);
                        title=jo.getString("deal_title");  //tag name "deal_title",will return value that we save in title string
                    des=jo.getString("deal_description");
       }
    }
    catch(Exeption e){
    }

在提到Android清单上网权限

Mention Internet permission in android manifest

这篇关于如何通过调用Android的一个JSON web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆