0

How can I parse this json in an android project?

{"code":200,"lang":"en-ru","**text**":["Лучше поздно, чем никогда"]}

I need only a part of "**text**":["Лучше поздно, чем никогда"]

Tanmay Patil
  • 6,882
  • 2
  • 25
  • 45

2 Answers2

0
JSONObject jObj = new JSONObject("{"code":200,"lang":"en-ru","text":"Лучше поздно, чем никогда"}");
String text = jObj.optString("text");
panini
  • 2,026
  • 19
  • 21
0

Check those links to understand the concept of JSON serialization/de-serialization

http://www.javacodegeeks.com/2013/10/android-json-tutorial-create-and-parse-json-data.html

http://www.vogella.com/tutorials/AndroidJSON/article.html

And here are the 2 most famous library for handling JSON:

GSON

https://sites.google.com/site/gson/gson-user-guide

&

Jackson

http://wiki.fasterxml.com/JacksonInFiveMinutes

Rami
  • 7,162
  • 1
  • 22
  • 19