मैं हूँ सर्वरएंड्रॉइड में जेसन प्रतिक्रिया को कैसे पार्स करें?
{"LL": { "control": "dev/sys/getkey", "value": "4545453030304138303046392035343733373432363020323031332D30322D31312031383A30313A3135", "Code": "200"}}
मैं सिर्फ ऊपर json प्रतिक्रिया से "value"
का मूल्य निकालना चाहते हैं करने के लिए GET अनुरोध का एक परिणाम में यह प्रतिक्रिया हो रही है।
मैं इस प्रतिक्रिया
findViewById(R.id.button1).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HttpResponse response = null;
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI(
"http://192.168.14.247/jdev/sys/getkey"));
response = client.execute(request);
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String responseText = null;
try {
responseText = EntityUtils.toString(response.getEntity());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("Parse Exception", e + "");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("IO Exception 2", e + "");
}
Log.i("responseText", responseText);
Toast.makeText(MainActivity.this, responseText + "",
Toast.LENGTH_SHORT).show();
}
});
मेरे सवाल पाने के लिए इस कोड का उपयोग हूँ यह है कि मैं कैसे इस पार्स और केवल "value"
टैग के मान को मिल सकती है। धन्यवाद
@QadirHussain: मतलब im यू नहीं मिल रहा है। हाँ आप सर्वर से जेसन स्ट्रिंग प्राप्त कर रहे हैं –