public static Listing fromJSON(JSONObject jsonObj) { Listing biz = new Listing(jsonObj); try { biz.id = jsonObj.getString("id"); biz.title = jsonObj.getString("dtitle"); biz.street = jsonObj.getString("addr"); biz.city = jsonObj.getString("city"); biz.state = jsonObj.getString("state"); biz.rating = jsonObj.getString("rating"); biz.phone = jsonObj.getString("phone"); biz.lat = jsonObj.getString("lat"); biz.lon = jsonObj.getString("lon"); // reviews.. JSONObject reviewObj = biz.getJSONObject("reviews"); if (reviewObj != null && reviewObj.getInt("count") > 0) { biz.reviews = Review.fromJSON(reviewObj.getJSONArray("review")); } else { biz.reviews = new ArrayList<Review>(); } // Image JSONObject imgObj = biz.getJSONObject("fullsize_photos"); if (imgObj.getInt("count") > 0) { biz.imageUrl = imgObj.getJSONArray("content").getJSONObject(0).getString("url"); } else { biz.imageUrl = null; } } catch (JSONException e) { Log.d("pinank", e.getMessage()); return null; } return biz; }