public static AutoCompletePrediction FromJson(JObject json) { var r = new AutoCompletePrediction { Description = json["description"].ToString(), Place_ID = json["place_id"].ToString(), Reference = json["reference"].ToString(), MainText = json["structured_formatting"]["main_text"].ToString(), SecondaryText = json["structured_formatting"]["secondary_text"].ToString(), }; return(r); }
public static AutoCompleteResult FromJson(JObject result) { var r = new AutoCompleteResult(); r.Status = result["status"].Value <string>(); r.AutoCompletePlaces = new List <AutoCompletePrediction>(); foreach (var obj in result["predictions"].Value <JArray>()) { r.AutoCompletePlaces.Add(AutoCompletePrediction.FromJson(obj.Value <JObject>())); } return(r); }
public static AutoCompletePrediction FromJson(JObject json) { var r = new AutoCompletePrediction { Description = json["description"].Value <string>(), ID = json["id"]?.Value <string>(), Place_ID = json["place_id"].Value <string>(), Reference = json["reference"]?.Value <string>(), MainText = json["structured_formatting"]["main_text"].Value <string>(), SecondaryText = json["structured_formatting"]["secondary_text"].Value <string>(), Terms = json["terms"]?.Value <JArray>().Select(p => p["value"].Value <string>()).ToList() ?? new List <string>(), Types = json["types"]?.Value <JArray>().Select(p => p.Value <string>()).ToList() ?? new List <string>(), }; return(r); }