I am hitting a api from asp.net c sharp code. From api i am getting this response
{
"results" : [
{
"address_components" : [
{
"long_name" : "564",
"short_name" : "564",
"types" : [ "street_number" ]
},
{
"long_name" : "Shadow Lane",
"short_name" : "Shadow Ln",
"types" : [ "route" ]
},
{
"long_name" : "Simi Valley",
"short_name" : "Simi Valley",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Ventura County",
"short_name" : "Ventura County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "93065",
"short_name" : "93065",
"types" : [ "postal_code" ]
},
{
"long_name" : "7380",
"short_name" : "7380",
"types" : [ "postal_code_suffix" ]
}
],
"formatted_address" : "564 Shadow Ln, Simi Valley, CA 93065, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 34.2302076,
"lng" : -118.8016784
},
"southwest" : {
"lat" : 34.2300908,
"lng" : -118.8019011
}
},
"location" : {
"lat" : 34.2301467,
"lng" : -118.8017991
},
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : 34.2314981802915,
"lng" : -118.8004744197085
},
"southwest" : {
"lat" : 34.2288002197085,
"lng" : -118.8031723802915
}
}
},
"place_id" : "ChIJy16ydnIv6IARCgIUVmhNO3Y",
"types" : [ "premise" ]
}
],
"status" : "OK"
}
Kindly let me now,how to store this object in c sharp class. What should be my class properties. please help me out on the same

Sachin SinghPosted Jun 17, 2022, 6:10 AM
Aniket NarvankarPosted Jun 19, 2022, 6:28 AM
Jignesh KumarPosted Jun 17, 2022, 10:23 AM
Hello,
You can create your classe and json deserielize as below,
Sachin SinghPosted Jun 17, 2022, 7:35 AM
Aniket NarvankarPosted Jun 17, 2022, 6:54 AM
still need help,what will be my main class name? Root? types { get; set; } address_components { get; set; } types { get; set; } results { get; set; }
public class Root
{
public class AddressComponent
{
public string long_name { get; set; }
public string short_name { get; set; }
public List
}
public class Bounds
{
public Northeast northeast { get; set; }
public Southwest southwest { get; set; }
}
public class Geometry
{
public Bounds bounds { get; set; }
public Location location { get; set; }
public string location_type { get; set; }
public Viewport viewport { 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 Result
{
public List
public string formatted_address { get; set; }
public Geometry geometry { get; set; }
public string place_id { get; set; }
public List
}
public class Root
{
public List
public string status { 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; }
}
}
Like this i should create?