Hi am learning rails and in my app, I'm getting values in json format from
res = @client.spots(params[:location][:lat], params[:location][:lng], :types => ['restaurant','food'], :radius => 500)
in my res object, I'm getting these values
{
"json_result_object": {
"business_status": "OPERATIONAL",
"geometry": {
"location": {
"lat": 31.4734563,
"lng": 74.2794873
},
},
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"name": "CP Five Star",
"opening_hours": {
"open_now": true
}
}
],
"place_id": "ChIJjfE-TdoDGTkRMom8KQfI9Uc",
"plus_code": {
"compound_code": "F7FH+9Q Lahore, Pakistan",
"global_code": "8J3PF7FH+9Q"
},
},
"reference": "ChIJjfE-TdoDGTkRMom8KQfI9Uc",
"place_id": "ChIJjfE-TdoDGTkRMom8KQfI9Uc",
"vicinity": "Bilal Arcade, Abdul Haque Road, Block G Block G Phase 1 Johar Town, Lahore",
"lat": 31.4734563,
"lng": 74.2794873,
"viewport": {
"northeast": {
"lat": 31.4748154802915,
"lng": 74.28081473029151
},
"southwest": {
"lat": 31.4721175197085,
"lng": 74.2781167697085
}
},
"name": "CP Five Star",
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"types": [
"restaurant",
"food",
"point_of_interest",
"establishment
}
now I just want to return a JSON array containing just the values below place_id , name , lat lng , icon
& Sorry I'm using image just to show my actual response in terminal image
Aucun commentaire:
Enregistrer un commentaire