This question has already been answered:

From the server I get the following Json:

{ "type": "FeatureCollection", "properties": { "Attribution": { "Sources": { "yandex": { "id": "yandex", "author": { "name": "Яндекс", "uri": "https:\/\/www.yandex.ru" } } } }, "ResponseMetaData": { "SearchRequest": { "request": "Веломастерская,ремонт велосипедов", "results": 1, "skip": 0, "boundedBy": [ [ 37.048426749999997, 55.436448290000001 ], [ 38.175902260000001, 56.046901239999997 ] ] }, "SearchResponse": { "found": 80, "Point": { "type": "Point", "coordinates": [ 23.820850969999999, 53.669822070000002 ] }, "boundedBy": [ [ 23.81916214, 53.668824499999999 ], [ 23.822539800000001, 53.670819620000003 ] ], "display": "multiple" } } }, "features": [ { "type": "Feature", "properties": { "id": "1", "CompanyMetaData": { "id": "1153226678", "name": "Веломастерская", "nameHighlight": [ [ 0, 14 ] ], "address": "Гродно, ул. Советских Пограничников, 51\/1", "Categories": [ { "name": "Ремонт велосипедов" } ], "Phones": [ { "type": "phone", "formatted": "+375 (29) 785-43-26", "country": "375", "prefix": "29", "number": "7854326" } ], "Hours": { "Availabilities": [ { "Monday": true, "Tuesday": true, "Wednesday": true, "Thursday": true, "Friday": true, "Intervals": [ { "from": "17:00:00", "to": "20:00:00" } ] } ], "text": "пн-пт 17:00–20:00", "tzOffset": 10800 }, "Geo": { "precision": "exact" } }, "description": "Гродно, ул. Советских Пограничников, 51\/1", "name": "Веломастерская", "boundedBy": [ [ 23.812622399999999, 53.66493534 ], [ 23.829079539999999, 53.67470823 ] ], "attributions": [ "#yandex" ] }, "geometry": { "type": "Point", "coordinates": [ 23.820847000000001, 53.669820000000001 ] }, "geometries": [ { "type": "Point", "coordinates": [ 23.820847000000001, 53.669820000000001 ] } ] } ] } 

I'm interested in the Name, address and formatted fields.

PS You can sample code

Reported as a duplicate by temq , Vladyslav Matviienko , user194374, fori1ton , zRrr Jul 7 '16 at 17:12 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Read this - Vladimir VSeos
  • Somebody email me the code, otherwise I'm lazy (with @Viktoor) - Vladyslav Matviienko
  • And why do you ask this question again? You already asked it. - Vladyslav Matviienko

1 answer 1

Here is the simplest example of working with JSON:

 {"someInt":"123","someString":"value1"} try { JSONObject json = new JSONObject(jsonString); int someInt = json.getInt("someInt"); String someString = json.getString("someString"); } catch (JSONException e) { // } 

And further:

 [{"key1":"value1","key2":"value2"},{"key1":"value1","key2":"value2"}] JSONArray jArray=new JSONArray(jsonString); for(int i=0;i<(jArray.length());i++) { JSONObject json_obj=jArray.getJSONObject(i); String value1=json_obj.getString("key1"); String value2=json_obj.getString("key2"); } 

Jsonobject

JSONArray

  • Further experiment yourself :) - Vladimir VSeos