Assign JSON value to property in C# -
From the API, I get a JSON object that looks like this:
{" air": {"speed": 7.31, "degree": 187.002} , "Rain": {"3h": "cloud": {"all": 92}, "coordinate": {"lon": 139, "late": 35}, "dt": 1369824698, ID: 1851632, "COD": 200, "Weather": [{"id": 804, "main": "cloud", "icon": "description": "cloudy cloud"}], "main": {"Humidity": 89, "Temp_max": 292.04, "Temp_man": 287.04, "Temp": 28 9.5, "Pressure": 1013}, "Sys": {"Country": "JP", "Sunrise ": 1369769524," Sunset ": 1369821049}," Name ":" ShoeZone "}
The in my class to assign these two values:
public class Weather {public string Name {get; Set; } Public string temporarily {get; Set; }}
The name that I can assign to:
weather.Name = TheJSON.name.ToString ();
But this is temporary, because it is located inside the "main" - night. How did I do this in javascript, but I have not seen much in C #. Thanks!
The main no array is not an object, so
TheJSON.main.temp.ToString ()