Android JSON解析:解析特定元素

时间:2017-02-18 12:39:04

标签: java android json parsing

我有一个提到过的吼叫你能不能让我知道如何在这个json中解析Tripname

我想要

增量 宝宝 蓝湾 whaynle

来自json的

MyJson 

[{"0":"$deta","Tripname":"delta"},{"0":"Baby","Tripname":"Baby"},{"0":"bluebay","Tripname":"bluebay"},{"0":"whaynle","Tripname":"whaynle"}]

System.out.println("--RESULT--" + result);
            JSONObject jObject = null;
            try {
                jObject = new JSONObject(result);

                //JSONArray a = jObject.getJSONArray("Tripname");


                String status = jObject.getString("Tripname");
                //Log.v("result1", jObject.toString());
                Log.v("Response", status);

            }
            catch (JSONException e)
            {
                e.printStackTrace();
            }

2 个答案:

答案 0 :(得分:3)

试试这个:

typedef struct {
    double a;
    double b;
    double c;
    unsigned int d;
    unsigned int e;
} mystruct;

mystruct m = { 2.333, 4.478, 2.447, 90, 43 };
printf("%.3f %.3f %.3f %u %u\n", m.a, m.b, m.c, m.d, m.e);

答案 1 :(得分:2)

这样做

Connection.Dispose()