After deserialization getting null object C# Windows Phone - c#

I was trying to play with an API. The API is returning the data in JSON.
Here is my code to make the request
private void makerequest()
{
HttpWebRequest request = HttpWebRequest.Create("http://grandtheftdata.com/bawsaq/api?a=DATA&o=JSON&p=PS3&t=2014-04-08T15:00:00Z," + now.ToString("YYYY-MM-DD") + "T" + now.ToString("HH:mm:ss") + "Z") as HttpWebRequest;
request.Method = "GET";
request.Accept = "application/json";
request.ContentLength = 0;
var playerResponse = request.BeginGetResponse(new AsyncCallback(getPlayer), request);
}
private void getPlayer(IAsyncResult ar)
{
try
{
string jsondata;
HttpWebRequest myHttpWebRequest = (HttpWebRequest)ar.AsyncState; ;
using (HttpWebResponse response = (HttpWebResponse)myHttpWebRequest.EndGetResponse(ar))
{
System.IO.Stream responseStream = response.GetResponseStream();
using (var reader = new System.IO.StreamReader(responseStream))
{
jsondata = reader.ReadToEnd();
}
responseStream.Close();
}
this.Dispatcher.BeginInvoke(() =>
{
PS3BAWSAQ.RootObject feed = Newtonsoft.Json.JsonConvert.DeserializeObject<PS3BAWSAQ.RootObject>(jsondata);
MessageBox.Show(jsondata.Length + " characters");
}
);
}
catch (Exception e)
{
//Do something
}
}
and the JSON data it is returning in jsondata variable is
{
"data": {
"PS3": {
"2014-04-08T15:30:01Z": {
"AMU": 3.42,
"BDG": 6.73,
"BET": 716.1,
"BFA": 83.58,
"BIN": 3.82,
"BLE": 3591.3,
"BRU": 4.5,
"BTR": 3.51,
"CNT": 50.15,
"CRE": 2.5,
"DGP": 100.16,
"EYE": 3.68,
"FAC": 3.49,
"FRT": 3.86,
"GOT": 6.09,
"HAL": 3.58,
"HVY": 1.45,
"LSC": 1551.79,
"LST": 1045.54,
"LTD": 336.95,
"MAI": 348.5,
"PIS": 2.64,
"PMP": 2143.31,
"PON": 1700.82,
"RON": 323.46,
"SHK": 7.03,
"SHR": 1261.47,
"SHT": 582.65,
"SPU": 1607.05,
"SUB": 1509.58,
"TNK": 5.56,
"UMA": 4.47,
"VAP": 6.86,
"VOM": 1183.48,
"WAP": 88.74,
"WIW": 7.16,
"WIZ": 1.28,
"WZL": 999.98,
"ZIT": 3.46
}
}
},
"status": {
"code": 200,
"text": "ok"
}
}
And the classes generated by json2csharp.com are
public class __invalid_type__20140324T144502Z
{
public double AMU { get; set; }
public double BDG { get; set; }
public double BET { get; set; }
public double BFA { get; set; }
public double BIN { get; set; }
public double BLE { get; set; }
public double BRU { get; set; }
public double BTR { get; set; }
public double CNT { get; set; }
public double CRE { get; set; }
public double DGP { get; set; }
public double EYE { get; set; }
public double FAC { get; set; }
public double FRT { get; set; }
public double GOT { get; set; }
public double HAL { get; set; }
public double HVY { get; set; }
public double LSC { get; set; }
public double LST { get; set; }
public double LTD { get; set; }
public double MAI { get; set; }
public double PIS { get; set; }
public double PMP { get; set; }
public double PON { get; set; }
public double RON { get; set; }
public double SHK { get; set; }
public double SHR { get; set; }
public double SHT { get; set; }
public double SPU { get; set; }
public double SUB { get; set; }
public double TNK { get; set; }
public double UMA { get; set; }
public double VAP { get; set; }
public double VOM { get; set; }
public double WAP { get; set; }
public double WIW { get; set; }
public double WIZ { get; set; }
public double WZL { get; set; }
public double ZIT { get; set; }
}
public class PS3
{
public __invalid_type__20140324T144502Z __invalid_name__2014 { get; set; }
}
public class Data
{
public PS3 PS3 { get; set; }
}
public class Status
{
public int code { get; set; }
public string text { get; set; }
}
public class RootObject
{
public Data data { get; set; }
public Status status { get; set; }
}
The thing is I am not able to deserialize the JSON data to PS3BAWSAQ object properly.
And I am sure the problem is in the class name(invalid type). I changed their names but that didn't help either. The JSON has a member which is itself time dependent.
Can't figure a way to solve this. Please help.

The JsonConvert.Deserialize(string) method returns a dynamic object.
This is where you create your dynamic object
dynamic x = JsonConvert.DeserializeObject(jsondata);
Dynamic objects are really nice to work with. You can reference properties that the compiler have no clue exist or not. You can read about them here
You must parse the dynamic object like this.
Assuming that its only returning one of the above objects in the JSON
PS3BAWSAQ.RootObject obj = new PS3BAWSAQ.RootObject (){
Prop1 = x.Key1,
Prop2 = x.Key2,
//And So on
};
if its a list of objects you do it like this
foreach(PS3BAWSAQ.RootObject y in x){
PS3BAWSAQ.RootObject obj = new PS3BAWSAQ.RootObject (){
Prop1 = y.Key1,
Prop2 = y.Key2,
//And So on
};
}
if its a list of lists do it like this
foreach(var y in x.list1Name){
foreach(PS3BAWSAQ.RootObject z in y){
PS3BAWSAQ.RootObject obj = new PS3BAWSAQ.RootObject (){
Prop1 = z.Key1,
Prop2 = z.Key2,
//And So on
};
}
}
In your case it looks like its a single object being returned. So you would want option one. Just new up a new container and set each property individually. THE KEYS ARE CASE SENSITIVE!!!

Related

Grabbing Json Data to String in Gridview

I'm setting up a website ASPX file that grabs the weather for the next 3 days, the output is in JSON and their classes are too complicated for me to understand it. If I want to extract just the weather for the next 3 days how do I go on about doing that?
https://samples.openweathermap.org/data/2.5/forecast?q=London,us&appid=b6907d289e10d714a6e88b30761fae22
This is the JSON output displayed on top.
What I'm trying to accomplish is to extract the next 3 days of the weather "Description" and put it to a GridView. I have used a JSON beautifier to get the classes but I am still confused.
Any help would be appreciated
This is my current code and I'm stuck here
protected void Button1_Click(object sender, EventArgs e)
{
string searchTerm = TextBox1.Text;
var webRequest = (HttpWebRequest)WebRequest.Create("https://samples.openweathermap.org/data/2.5/forecast?q=" + Server.UrlEncode(searchTerm) + "&units=metric&APPID=b6907d289e10d714a6e88b30761fae22");
var webResponse = (HttpWebResponse)webRequest.GetResponse();
if (webResponse.StatusCode == HttpStatusCode.OK)
{
Label1.Text = "The Next 3 days of weather in your area in" + searchTerm + " .";
JavaScriptSerializer json = new JavaScriptSerializer();
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
string resString = sr.ReadToEnd();
});
GridView1.DataSource = ?;
GridView1.DataBind();
}
else
Label.Text = "Invalid Response";
}
public class Main
{
public double temp { get; set; }
public double temp_min { get; set; }
public double temp_max { get; set; }
public double pressure { get; set; }
public double sea_level { get; set; }
public double grnd_level { get; set; }
public int humidity { get; set; }
public double temp_kf { get; set; }
}
public class Weather
{
public int id { get; set; }
public string main { get; set; }
public string description { get; set; }
public string icon { get; set; }
}
public class Clouds
{
public int all { get; set; }
}
public class Wind
{
public double speed { get; set; }
public double deg { get; set; }
}
public class Sys
{
public string pod { get; set; }
}
public class Rain
{
public double __invalid_name__3h { get;
set; }
}
public class Snow
{
public double __invalid_name__3h { get;
set; }
}
public class List
{
public int dt { get; set; }
public Main main { get; set; }
public List<Weather> weather { get; set; }
public Clouds clouds { get; set; }
public Wind wind { get; set; }
public Sys sys { get; set; }
public string dt_txt { get; set; }
public Rain rain { get; set; }
public Snow snow { get; set; }
}
public class Coord
{
public double lat { get; set; }
public double lon { get; set; }
}
public class City
{
public int id { get; set; }
public string name { get; set; }
public Coord coord { get; set; }
public string country { get; set; }
}
public class RootObject
{
public string cod { get; set; }
public double message { get; set; }
public int cnt { get; set; }
public List<List> list { get; set; }
public City city { get; set; }
}

Incorrect JSON Output Using ASP.NET

Please excuse this question as a sign of frustration. While I understand that cause of the issue is the converting of data into different types, I can't put my finger on what's causing the result of this web service get method to be output incorrectly, that is containing backslashes.
The code below sums up the functionality of my method. I've tried different suggestions I found on these forums, some of which were in reply to similar questions I asked myself.
Data Model
public class WeatherResponse
{
public class Coord
{
public double lon { get; set; }
public double lat { get; set; }
}
public class Weather
{
public int id { get; set; }
public string main { get; set; }
public string description { get; set; }
public string icon { get; set; }
}
public class Main
{
public double temp { get; set; }
public int pressure { get; set; }
public int humidity { get; set; }
public int temp_min { get; set; }
public int temp_max { get; set; }
}
public class Wind
{
public double speed { get; set; }
public int deg { get; set; }
}
public class Clouds
{
public int all { get; set; }
}
public class Sys
{
public int type { get; set; }
public int id { get; set; }
public double message { get; set; }
public string country { get; set; }
public int sunrise { get; set; }
public int sunset { get; set; }
}
public class RootObject
{
public Coord coord { get; set; }
public List<WeatherResponse> weather { get; set; }
public string #base { get; set; }
public Main main { get; set; }
public int visibility { get; set; }
public Wind wind { get; set; }
public Clouds clouds { get; set; }
public int dt { get; set; }
public Sys sys { get; set; }
public int id { get; set; }
public string name { get; set; }
public int cod { get; set; }
}
}
Controller
[HttpGet]
public string Get(string city, string country)
{
string apiKey = "KEY";
HttpWebRequest apiRequest = WebRequest.Create("http://api.openweathermap.org/data/2.5/weather?q=" + city + "," + country + " &appid=" + apiKey + "&units=metric") as HttpWebRequest;
string apiResponse = "";
using (HttpWebResponse response = apiRequest.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
apiResponse = reader.ReadToEnd();
}
Response.ContentType = "application/json";
return apiResponse;
}
Result
"{\"coord\":{\"lon\":-0.13,\"lat\":51.51},\"weather\":[{\"id\":521,\"main\":\"Rain\",\"description\":\"shower
rain\",\"icon\":\"09d\"}],\"base\":\"stations\",\"main\":{\"temp\":2.62,\"pressure\":991,\"humidity\":69,\"temp_min\":1,\"temp_max\":4},\"visibility\":10000,\"wind\":{\"speed\":5.1,\"deg\":90},\"clouds\":{\"all\":75},\"dt\":1548939000,\"sys\":{\"type\":1,\"id\":1414,\"message\":0.0037,\"country\":\"GB\",\"sunrise\":1548920401,\"sunset\":1548953318},\"id\":2643743,\"name\":\"London\",\"cod\":200}"
I need the code to simply retrieve weather data using the city and country received and correctly output it as JSON.
Here's the solution to the problem, as kindly posted by Joroen Mostert.
You should be able to use Content for this (when you change the return
type of your method to IActionResult): return Content(apiResponse,
"application/json") should not further escape.

Deserialize Json String to C# object

I'm trying out the Philips Hue lights api for the first time and I have a few questions on how to deserialize the json string to a C# object. I'm trying this out for the Xamarin.iOS app I'm working on.
Here's my method that would fetch the light data from around me:
private string getLights()
{
var url = APIURL + APIKey + LightsEndPoint ;
var request = WebRequest.Create(url);
request.ContentType = "application/json";
request.Method = "GET";
using (var response = request.GetResponse() as HttpWebResponse)
{
if (response.StatusCode != HttpStatusCode.OK)
Console.Out.WriteLine(
"Error fetching data. Server returned status code: {0}",
response.StatusCode);
using (var reader = new StreamReader(response.GetResponseStream()))
{
var content = reader.ReadToEnd();
if(string.IsNullOrWhiteSpace(content))
{
Console.WriteLine("Response contained empty body...");
}
else
{
Console.WriteLine("Response Body: \r\n {0}", content);
var items = JsonConvert.DeserializeObject <Light> (content);
}
return content;
}
}
}
Where Light is:
public class Light
{
public Light()
{ }
public string LightName { get; set;}
[JsonProperty("state")]
public string IsOn { get; set; }
[JsonProperty("sat")]
public int Saturation { get; set; }
[JsonProperty("bri")]
public int Brightness {get;set;}
[JsonProperty("hue")]
public int Hue { get; set; }
}
The problem I'm having now is my items object is always empty, null values even though I'm properly getting content json string.
My json string looks like this:
{
"1":{
"state":{
"on":true,
"bri":254,
"hue":20000,
"sat":100,
"effect":"none",
"xy":[
0.4146,
0.4155
],
"ct":299,
"alert":"none",
"colormode":"hs",
"reachable":true
},
"type":"Extended color light",
"name":"Hue color lamp 1",
"modelid":"LCT007",
"manufacturername":"Philips",
"uniqueid":"00:17:88:01:10:26:3f:12-0b",
"swversion":"5.38.1.14919"
},
"2":{
"state":{
"on":false,
"bri":254,
"hue":50000,
"sat":254,
"effect":"none",
"xy":[
0.2468,
0.0843
],
"ct":153,
"alert":"none",
"colormode":"hs",
"reachable":true
},
"type":"Extended color light",
"name":"Hue color lamp 2",
"modelid":"LCT007",
"manufacturername":"Philips",
"uniqueid":"00:17:88:01:10:5d:fd:f6-0b",
"swversion":"5.38.1.14919"
},
"3":{
"state":{
"on":true,
"bri":254,
"hue":10000,
"sat":254,
"effect":"none",
"xy":[
0.5711,
0.3986
],
"ct":500,
"alert":"none",
"colormode":"hs",
"reachable":true
},
"type":"Extended color light",
"name":"Hue color lamp 3",
"modelid":"LCT007",
"manufacturername":"Philips",
"uniqueid":"00:17:88:01:10:26:3d:17-0b",
"swversion":"5.38.1.14919"
}
}
The problem I'm having is light is indicated by a numerical value and I'm not sure how to split the json string to populate my c# object.
Basically, I'm having issues converting the json string to c# object for api stream for Xamarin.iOS app.
Your model should look like this
public class Light
{
public Light()
{
}
[JsonProperty("name")]
public string LightName { get; set;}
[JsonProperty("state")]
public State State { get; set; }
}
public class State
{
public State()
{
}
[JsonProperty("on")]
public bool IsOn { get; set; }
[JsonProperty("sat")]
public int Saturation { get; set; }
[JsonProperty("bri")]
public int Brightness {get;set;}
[JsonProperty("hue")]
public int Hue { get; set; }
}
And deserialization call should look like this
JsonConvert.DeserializeObject<Dictionary<string, Light>>(content);
Where the key of the dictionary is the numbers and value is the light model you want to get.
I generated a class with json2csharp:
public class State
{
public bool on { get; set; }
public int bri { get; set; }
public int hue { get; set; }
public int sat { get; set; }
public string effect { get; set; }
public List<double> xy { get; set; }
public int ct { get; set; }
public string alert { get; set; }
public string colormode { get; set; }
public bool reachable { get; set; }
}
public class RootObject
{
public State state { get; set; }
public string type { get; set; }
public string name { get; set; }
public string modelid { get; set; }
public string manufacturername { get; set; }
public string uniqueid { get; set; }
public string swversion { get; set; }
}
then I called this code:
var a = JsonConvert.DeserializeObject<Dictionary<string, RootObject>>(json);
and the result was this:
As mentioned, your model structure does not match that of the json's. You need to properly nest the properties accordingly. I threw together an example, though certain data types I was unsure of I simply used a string(Which should be fine).
Light.cs
public class Light
{
public string LightName { get; set; }
[JsonProperty("state")]
public State LightState { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("modelid")]
public string ModelId { get; set; }
[JsonProperty("manufacturername")]
public string Manufacturer { get; set; }
[JsonProperty("uniqueid")]
public string UniqueId { get; set; }
[JsonProperty("swversion")]
public string SwVersion { get; set; }
}
State.cs
public class State
{
[JsonProperty("on")]
public bool IsOn { get; set; }
[JsonProperty("bri")]
public int Brightness { get; set; }
[JsonProperty("hue")]
public int Hue { get; set; }
[JsonProperty("sat")]
public int Saturation { get; set; }
[JsonProperty("effect")]
public string Effect { get; set; } // Just making it a string for now
[JsonProperty("xy")]
public double[] XY { get; set; }
[JsonProperty("ct")]
public int CT { get; set; }
[JsonProperty("alert")]
public string Alert { get; set; } // Just making another string for now
[JsonProperty("colormode")]
public string ColorMode { get; set; } // Hey, it's another string for now
[JsonProperty("reachable")]
public bool Reachable { get; set; }
}
Then to deserialize:
var items = JsonConvert.DeserializeObject<Dictionary<string, Light>> (content);

Deserializing a JSON into a C# List of Objects

I am trying to Deserialize a JSON from google places api. My custom class is set up as follows and my code looks like this. My Program throws no errors when running but my places object is null.
class PlacesDictionary
{
public void placesDictionary()
{ }
public Places GetPlaces()
{
Places places = new Places();
string apiKey = "I have an apiKey";
string googleUrl;
googleUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=43.038902,-87.906474&radius=500&type=restaurant&name=cruise&key=" + apiKey;
WebRequest request = WebRequest.Create(googleUrl);
request.Method = "GET";
request.ContentType = "application/x-www-form-urlencoded";
WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
places = JsonConvert.DeserializeObject<Places>(responseFromServer);
Console.WriteLine(responseFromServer);
Console.ReadLine();
reader.Close();
dataStream.Close();
response.Close();
return places;
}
}
public class Places
{
public List<Place> places { get; set; }
public class Place
{
public Geometry geometry { get; set; }
public string icon { get; set; }
public string id { get; set; }
public string name { get; set; }
public OpeningHours opening_hours { get; set; }
public List<Photo> photos { get; set; }
public string place_id { get; set; }
public int price_level { get; set; }
public double rating { get; set; }
public string reference { get; set; }
public string scope { get; set; }
public List<string> types { get; set; }
public string vicinity { get; set; }
public class Location
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Northeast
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Southwest
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Viewport
{
public Northeast northeast { get; set; }
public Southwest southwest { get; set; }
}
public class Geometry
{
public Location location { get; set; }
public Viewport viewport { get; set; }
}
public class OpeningHours
{
public bool open_now { get; set; }
public List<object> weekday_text { get; set; }
}
public class Photo
{
public int height { get; set; }
public List<string> html_attributions { get; set; }
public string photo_reference { get; set; }
public int width { get; set; }
}
}
}
I think you should use
List<Place> places = JsonConvert.DeserializeObject<List<Place>>(responseFromServer);
instead of
places = JsonConvert.DeserializeObject<Places>(responseFromServer);
and don't forget remove following line
Places places = new Places();
Edit: Full Answer
static void Main(string[] args)
{
string apiKey = "your api key";
string googleUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=43.038902,-87.906474&radius=500&type=restaurant&name=cruise&key=" + apiKey;
WebRequest request = WebRequest.Create(googleUrl);
request.Method = "GET";
request.ContentType = "application/x-www-form-urlencoded";
WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
//StreamWriter wr = new StreamWriter("json.txt");
//wr.WriteLine(responseFromServer);
//wr.Flush();
//To see what it is inside json
Result results = JsonConvert.DeserializeObject<Result>(responseFromServer);
Console.WriteLine(responseFromServer);
Console.ReadLine();
reader.Close();
dataStream.Close();
response.Close();
}
}
public class Result
{
public List<HTMLAttribution> html_attributions { get; set; }
public string next_page_token { get; set; }
public List<Place> results { get; set; }
public string status { get; set; }
//Definations of Classes
public class HTMLAttribution { } //I don't what it is. It is empty for your url.
public class Place
{
public Geometry geometry { get; set; }
public string icon { get; set; }
public string id { get; set; }
public string name { get; set; }
public OpeningHours opening_hours { get; set; }
public List<Photo> photos { get; set; }
public string place_id { get; set; }
public int price_level { get; set; }
public double rating { get; set; }
public string reference { get; set; }
public string scope { get; set; }
public List<string> types { get; set; }
public string vicinity { get; set; }
public class Geometry
{
public Location location { get; set; }
public Viewport viewport { get; set; }
}
public class Location
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Viewport
{
public Northeast northeast { get; set; }
public Southwest southwest { get; set; }
}
public class Northeast
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Southwest
{
public double lat { get; set; }
public double lng { get; set; }
}
public class OpeningHours
{
public bool open_now { get; set; }
public List<object> weekday_text { get; set; }
}
public class Photo
{
public int height { get; set; }
public List<string> html_attributions { get; set; }
public string photo_reference { get; set; }
public int width { get; set; }
}
}
}
I would try something (if I were you) :
delete
Places places = new Places();
replace
places = JsonConvert.DeserializeObject(responseFromServer);
by
Places places = JsonConvert.DeserializeObject(responseFromServer);
and add a default constructor in your class Places like you have add in PlacesDictionary.
1.Just have Place class only.
2.Initialize List<Place> places=new List<Place>()
3.Deserialize using places
places = JsonConvert.DeserializeObject<places>(responseFromServer);

Deserialize JSON string(geocode API's google) to object using JSON.NET c#

I ' m using the geocode API's Google, I can get the JSON string with all dates , but when i will convert it in a object, it do not work, it return anything,I'm using the JSON.NET, i'm doing something wrong ?
in all JSON data, I wanna just take the formatted_address.
json request : http://maps.googleapis.com/maps/api/geocode/json?address=av.paulista&sensor=false%22
sorry my bad English
my main form: getting the JSON data(working)
private void btnConsumir_Click(object sender, EventArgs e)
{
string address = txtAddress.Text ;
string searchCode = "http://maps.googleapis.com/maps/api/geocode/json?address=" + address + "&sensor=false";
var JSONdata = "";
var httpWebRequest = (HttpWebRequest)WebRequest.Create(searchCode);
httpWebRequest.ContentType = "text/json";
httpWebRequest.Method = "POST";
var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream());
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
JSONdata = streamReader.ReadToEnd();
}
lblJSON.Text = JSONdata;//its a label
here i want get the formatted_address information on json:
[...]
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
JSONdata = streamReader.ReadToEnd();
}
lblJSON.Text = JSONdata;//its a label
AddressObject addressObject = JsonConvert.DeserializeObject<addressObject>(JSONdata);
string result = addressObject.formatted_address;
lblJSON.Text = result;
and this is my class object:
class AddressObject
{
public string formatted_address { get; set; }
}
thank you so much!
The results that come back from the api are much more than formatted_address. You need to deserialize the entire graph, then pluck out what you want.
With the class structure below, you can do this:
Rootobject mapdata = JsonConvert.DeserializeObject<Rootobject>(JSONdata);
...
public class Rootobject
{
public Result[] results { get; set; }
public string status { get; set; }
}
public class Result
{
public Address_Components[] address_components { get; set; }
public string formatted_address { get; set; }
public Geometry geometry { get; set; }
public string place_id { get; set; }
public string[] types { get; set; }
}
public class Geometry
{
public Location location { get; set; }
public string location_type { get; set; }
public Viewport viewport { get; set; }
}
public class Location
{
public float lat { get; set; }
public float lng { get; set; }
}
public class Viewport
{
public Northeast northeast { get; set; }
public Southwest southwest { get; set; }
}
public class Northeast
{
public float lat { get; set; }
public float lng { get; set; }
}
public class Southwest
{
public float lat { get; set; }
public float lng { get; set; }
}
public class Address_Components
{
public string long_name { get; set; }
public string short_name { get; set; }
public string[] types { get; set; }
}

Categories

Resources