Parse Json to Objects C #

4

I have a Json that comes down from an Api of wunderground and it's huge. How can I pass it to an object from which I can retrieve the data in a legible and neat way?

I tried that, but it did not work.

public void ProcesaJson{
  var cli = new WebClient();
        string weather = cli.DownloadString(http://api.wunderground.com/api/875ffcffceb88b9c/hourly/es/q/-31.4,-64.1833.json);
        dynamic stuff = JObject.Parse(weather);

        string hora = stuff.hour; //devuelve null

}

JSON:

{
  "response": {
  "version":"0.1",
  "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
  "features": {
  "hourly": 1
  }
        ,
    "error": {
        "type": "unknownfeature"
    }
    }
        ,
    "hourly_forecast": [
        {
        "FCTTIME": {
        "hour": "16","hour_padded": "16","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "15","mday_padded": "15","yday": "14","isdst": "0","epoch": "1516042800","pretty": "4:00 PM -03 on January 15, 2018","civil": "4:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Monday","weekday_name_night": "Monday Night","weekday_name_abbrev": "Mon","weekday_name_unlang": "Monday","weekday_name_night_unlang": "Monday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "85", "metric": "29"},
        "dewpoint": {"english": "59", "metric": "15"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
        "fctcode": "2",
        "sky": "30",
        "wspd": {"english": "11", "metric": "18"},
        "wdir": {"dir": "NE", "degrees": "55"},
        "wx": "Partly Cloudy",
        "uvi": "8",
        "humidity": "42",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "84", "metric": "29"},
        "feelslike": {"english": "84", "metric": "29"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "6",
        "mslp": {"english": "29.82", "metric": "1010"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "0","hour_padded": "00","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516071600","pretty": "12:00 AM -03 on January 16, 2018","civil": "12:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "68", "metric": "20"},
        "dewpoint": {"english": "61", "metric": "16"},
        "condition": "Clear",
        "icon": "clear",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",
        "fctcode": "1",
        "sky": "21",
        "wspd": {"english": "7", "metric": "11"},
        "wdir": {"dir": "N", "degrees": "349"},
        "wx": "Mostly Clear",
        "uvi": "0",
        "humidity": "77",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "68", "metric": "20"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "1",
        "mslp": {"english": "29.92", "metric": "1013"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "1","hour_padded": "01","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516075200","pretty": "1:00 AM -03 on January 16, 2018","civil": "1:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "67", "metric": "19"},
        "dewpoint": {"english": "59", "metric": "15"},
        "condition": "Clear",
        "icon": "clear",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",
        "fctcode": "1",
        "sky": "16",
        "wspd": {"english": "5", "metric": "8"},
        "wdir": {"dir": "NNW", "degrees": "347"},
        "wx": "Clear",
        "uvi": "0",
        "humidity": "76",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "67", "metric": "19"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "1",
        "mslp": {"english": "29.92", "metric": "1013"}
        }
        ,

        {
        "FCTTIME": {
        "hour": "4","hour_padded": "04","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516086000","pretty": "4:00 AM -03 on January 16, 2018","civil": "4:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "65", "metric": "18"},
        "dewpoint": {"english": "57", "metric": "14"},
        "condition": "Clear",
        "icon": "clear",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",
        "fctcode": "1",
        "sky": "3",
        "wspd": {"english": "5", "metric": "8"},
        "wdir": {"dir": "N", "degrees": "350"},
        "wx": "Clear",
        "uvi": "0",
        "humidity": "76",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "65", "metric": "18"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "2",
        "mslp": {"english": "29.91", "metric": "1013"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "5","hour_padded": "05","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516089600","pretty": "5:00 AM -03 on January 16, 2018","civil": "5:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "64", "metric": "18"},
        "dewpoint": {"english": "56", "metric": "13"},
        "condition": "Clear",
        "icon": "clear",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",
        "fctcode": "1",
        "sky": "4",
        "wspd": {"english": "5", "metric": "8"},
        "wdir": {"dir": "NNW", "degrees": "342"},
        "wx": "Clear",
        "uvi": "0",
        "humidity": "75",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "64", "metric": "18"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "2",
        "mslp": {"english": "29.91", "metric": "1013"}
        }
        ,

        {
        "FCTTIME": {
        "hour": "16","hour_padded": "16","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516129200","pretty": "4:00 PM -03 on January 16, 2018","civil": "4:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "86", "metric": "30"},
        "dewpoint": {"english": "57", "metric": "14"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
        "fctcode": "2",
        "sky": "32",
        "wspd": {"english": "11", "metric": "18"},
        "wdir": {"dir": "NE", "degrees": "47"},
        "wx": "Partly Cloudy",
        "uvi": "8",
        "humidity": "37",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "85", "metric": "29"},
        "feelslike": {"english": "85", "metric": "29"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "0",
        "mslp": {"english": "29.83", "metric": "1010"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "17","hour_padded": "17","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516132800","pretty": "5:00 PM -03 on January 16, 2018","civil": "5:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "86", "metric": "30"},
        "dewpoint": {"english": "56", "metric": "13"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
        "fctcode": "2",
        "sky": "42",
        "wspd": {"english": "12", "metric": "19"},
        "wdir": {"dir": "NE", "degrees": "45"},
        "wx": "Partly Cloudy",
        "uvi": "5",
        "humidity": "36",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "85", "metric": "29"},
        "feelslike": {"english": "85", "metric": "29"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "0",
        "mslp": {"english": "29.8", "metric": "1009"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "18","hour_padded": "18","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516136400","pretty": "6:00 PM -03 on January 16, 2018","civil": "6:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "86", "metric": "30"},
        "dewpoint": {"english": "57", "metric": "14"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
        "fctcode": "2",
        "sky": "49",
        "wspd": {"english": "11", "metric": "18"},
        "wdir": {"dir": "NE", "degrees": "47"},
        "wx": "Partly Cloudy",
        "uvi": "2",
        "humidity": "38",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "85", "metric": "29"},
        "feelslike": {"english": "85", "metric": "29"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "0",
        "mslp": {"english": "29.8", "metric": "1009"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "19","hour_padded": "19","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516140000","pretty": "7:00 PM -03 on January 16, 2018","civil": "7:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "84", "metric": "29"},
        "dewpoint": {"english": "57", "metric": "14"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
        "fctcode": "2",
        "sky": "52",
        "wspd": {"english": "11", "metric": "18"},
        "wdir": {"dir": "NE", "degrees": "53"},
        "wx": "Partly Cloudy",
        "uvi": "1",
        "humidity": "40",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "83", "metric": "29"},
        "feelslike": {"english": "83", "metric": "29"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "0",
        "mslp": {"english": "29.8", "metric": "1009"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "20","hour_padded": "20","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516143600","pretty": "8:00 PM -03 on January 16, 2018","civil": "8:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "80", "metric": "27"},
        "dewpoint": {"english": "59", "metric": "15"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
        "fctcode": "2",
        "sky": "54",
        "wspd": {"english": "9", "metric": "14"},
        "wdir": {"dir": "NE", "degrees": "54"},
        "wx": "Partly Cloudy",
        "uvi": "0",
        "humidity": "48",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "81", "metric": "27"},
        "feelslike": {"english": "80", "metric": "27"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "0",
        "mslp": {"english": "29.82", "metric": "1010"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "21","hour_padded": "21","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516147200","pretty": "9:00 PM -03 on January 16, 2018","civil": "9:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "76", "metric": "24"},
        "dewpoint": {"english": "59", "metric": "15"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_partlycloudy.gif",
        "fctcode": "2",
        "sky": "54",
        "wspd": {"english": "6", "metric": "10"},
        "wdir": {"dir": "NE", "degrees": "46"},
        "wx": "Partly Cloudy",
        "uvi": "0",
        "humidity": "56",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "76", "metric": "24"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "2",
        "mslp": {"english": "29.85", "metric": "1011"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "22","hour_padded": "22","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516150800","pretty": "10:00 PM -03 on January 16, 2018","civil": "10:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "73", "metric": "23"},
        "dewpoint": {"english": "59", "metric": "15"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_partlycloudy.gif",
        "fctcode": "2",
        "sky": "50",
        "wspd": {"english": "4", "metric": "6"},
        "wdir": {"dir": "N", "degrees": "8"},
        "wx": "Partly Cloudy",
        "uvi": "0",
        "humidity": "63",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "73", "metric": "23"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "3",
        "mslp": {"english": "29.87", "metric": "1012"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "23","hour_padded": "23","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "16","mday_padded": "16","yday": "15","isdst": "0","epoch": "1516154400","pretty": "11:00 PM -03 on January 16, 2018","civil": "11:00 PM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Tuesday","weekday_name_night": "Tuesday Night","weekday_name_abbrev": "Tue","weekday_name_unlang": "Tuesday","weekday_name_night_unlang": "Tuesday Night","ampm": "PM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "71", "metric": "22"},
        "dewpoint": {"english": "60", "metric": "16"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_partlycloudy.gif",
        "fctcode": "2",
        "sky": "45",
        "wspd": {"english": "5", "metric": "8"},
        "wdir": {"dir": "NW", "degrees": "310"},
        "wx": "Partly Cloudy",
        "uvi": "0",
        "humidity": "68",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "71", "metric": "22"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "4",
        "mslp": {"english": "29.9", "metric": "1013"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "0","hour_padded": "00","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "17","mday_padded": "17","yday": "16","isdst": "0","epoch": "1516158000","pretty": "12:00 AM -03 on January 17, 2018","civil": "12:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Wednesday","weekday_name_night": "Wednesday Night","weekday_name_abbrev": "Wed","weekday_name_unlang": "Wednesday","weekday_name_night_unlang": "Wednesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "70", "metric": "21"},
        "dewpoint": {"english": "61", "metric": "16"},
        "condition": "Partly Cloudy",
        "icon": "partlycloudy",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_partlycloudy.gif",
        "fctcode": "2",
        "sky": "48",
        "wspd": {"english": "6", "metric": "10"},
        "wdir": {"dir": "W", "degrees": "267"},
        "wx": "Partly Cloudy",
        "uvi": "0",
        "humidity": "74",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "70", "metric": "21"},
        "qpf": {"english": "0.0", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "12",
        "mslp": {"english": "29.92", "metric": "1013"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "1","hour_padded": "01","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "17","mday_padded": "17","yday": "16","isdst": "0","epoch": "1516161600","pretty": "1:00 AM -03 on January 17, 2018","civil": "1:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Wednesday","weekday_name_night": "Wednesday Night","weekday_name_abbrev": "Wed","weekday_name_unlang": "Wednesday","weekday_name_night_unlang": "Wednesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "69", "metric": "21"},
        "dewpoint": {"english": "61", "metric": "16"},
        "condition": "Chance of Rain",
        "icon": "chancerain",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_chancerain.gif",
        "fctcode": "12",
        "sky": "47",
        "wspd": {"english": "6", "metric": "10"},
        "wdir": {"dir": "W", "degrees": "275"},
        "wx": "Few Showers",
        "uvi": "0",
        "humidity": "77",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "69", "metric": "21"},
        "qpf": {"english": "0.01", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "32",
        "mslp": {"english": "29.91", "metric": "1013"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "2","hour_padded": "02","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "17","mday_padded": "17","yday": "16","isdst": "0","epoch": "1516165200","pretty": "2:00 AM -03 on January 17, 2018","civil": "2:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Wednesday","weekday_name_night": "Wednesday Night","weekday_name_abbrev": "Wed","weekday_name_unlang": "Wednesday","weekday_name_night_unlang": "Wednesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "68", "metric": "20"},
        "dewpoint": {"english": "61", "metric": "16"},
        "condition": "Chance of Rain",
        "icon": "chancerain",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_chancerain.gif",
        "fctcode": "12",
        "sky": "54",
        "wspd": {"english": "6", "metric": "10"},
        "wdir": {"dir": "WSW", "degrees": "254"},
        "wx": "Showers",
        "uvi": "0",
        "humidity": "79",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "68", "metric": "20"},
        "qpf": {"english": "0.02", "metric": "1"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "40",
        "mslp": {"english": "29.9", "metric": "1013"}
        }
        ,
        {
        "FCTTIME": {
        "hour": "3","hour_padded": "03","min": "00","min_unpadded": "0","sec": "0","year": "2018","mon": "1","mon_padded": "01","mon_abbrev": "Jan","mday": "17","mday_padded": "17","yday": "16","isdst": "0","epoch": "1516168800","pretty": "3:00 AM -03 on January 17, 2018","civil": "3:00 AM","month_name": "January","month_name_abbrev": "Jan","weekday_name": "Wednesday","weekday_name_night": "Wednesday Night","weekday_name_abbrev": "Wed","weekday_name_unlang": "Wednesday","weekday_name_night_unlang": "Wednesday Night","ampm": "AM","tz": "","age": "","UTCDATE": ""
        },
        "temp": {"english": "68", "metric": "20"},
        "dewpoint": {"english": "61", "metric": "16"},
        "condition": "Chance of Rain",
        "icon": "chancerain",
        "icon_url":"http://icons.wxug.com/i/c/k/nt_chancerain.gif",
        "fctcode": "12",
        "sky": "60",
        "wspd": {"english": "6", "metric": "10"},
        "wdir": {"dir": "WSW", "degrees": "253"},
        "wx": "Showers",
        "uvi": "0",
        "humidity": "79",
        "windchill": {"english": "-9999", "metric": "-9999"},
        "heatindex": {"english": "-9999", "metric": "-9999"},
        "feelslike": {"english": "68", "metric": "20"},
        "qpf": {"english": "0.01", "metric": "0"},
        "snow": {"english": "0.0", "metric": "0"},
        "pop": "39",
        "mslp": {"english": "29.88", "metric": "1012"}
        }
    ]
}
    
asked by Ariel Octavio D'Alfeo 15.01.2018 в 20:06
source

2 answers

2

The first thing I recommend is to generate a C # class using your JSON. You can generate it in quicktype.io . With this application the class generated is the following:

// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
//    using QuickType;
//
//    var data = Weather.FromJson(jsonString);

namespace ConsoleApp1.Classes
{
    using System;
    using System.Net;
    using System.Collections.Generic;

    using Newtonsoft.Json;

    public partial class Weather
    {
        [JsonProperty("response")]
        public Response Response { get; set; }

        [JsonProperty("hourly_forecast")]
        public HourlyForecast[] HourlyForecast { get; set; }
    }

    public partial class HourlyForecast
    {
        [JsonProperty("FCTTIME")]
        public Fcttime Fcttime { get; set; }

        [JsonProperty("temp")]
        public Dewpoint Temp { get; set; }

        [JsonProperty("dewpoint")]
        public Dewpoint Dewpoint { get; set; }

        [JsonProperty("condition")]
        public string Condition { get; set; }

        [JsonProperty("icon")]
        public string Icon { get; set; }

        [JsonProperty("icon_url")]
        public string IconUrl { get; set; }

        [JsonProperty("fctcode")]
        public string Fctcode { get; set; }

        [JsonProperty("sky")]
        public string Sky { get; set; }

        [JsonProperty("wspd")]
        public Dewpoint Wspd { get; set; }

        [JsonProperty("wdir")]
        public Wdir Wdir { get; set; }

        [JsonProperty("wx")]
        public string Wx { get; set; }

        [JsonProperty("uvi")]
        public string Uvi { get; set; }

        [JsonProperty("humidity")]
        public string Humidity { get; set; }

        [JsonProperty("windchill")]
        public Dewpoint Windchill { get; set; }

        [JsonProperty("heatindex")]
        public Dewpoint Heatindex { get; set; }

        [JsonProperty("feelslike")]
        public Dewpoint Feelslike { get; set; }

        [JsonProperty("qpf")]
        public Dewpoint Qpf { get; set; }

        [JsonProperty("snow")]
        public Dewpoint Snow { get; set; }

        [JsonProperty("pop")]
        public string Pop { get; set; }

        [JsonProperty("mslp")]
        public Dewpoint Mslp { get; set; }
    }

    public partial class Dewpoint
    {
        [JsonProperty("english")]
        public string English { get; set; }

        [JsonProperty("metric")]
        public string Metric { get; set; }
    }

    public partial class Fcttime
    {
        [JsonProperty("hour")]
        public string Hour { get; set; }

        [JsonProperty("hour_padded")]
        public string HourPadded { get; set; }

        [JsonProperty("min")]
        public string Min { get; set; }

        [JsonProperty("min_unpadded")]
        public string MinUnpadded { get; set; }

        [JsonProperty("sec")]
        public string Sec { get; set; }

        [JsonProperty("year")]
        public string Year { get; set; }

        [JsonProperty("mon")]
        public string Mon { get; set; }

        [JsonProperty("mon_padded")]
        public string MonPadded { get; set; }

        [JsonProperty("mon_abbrev")]
        public string MonAbbrev { get; set; }

        [JsonProperty("mday")]
        public string Mday { get; set; }

        [JsonProperty("mday_padded")]
        public string MdayPadded { get; set; }

        [JsonProperty("yday")]
        public string Yday { get; set; }

        [JsonProperty("isdst")]
        public string Isdst { get; set; }

        [JsonProperty("epoch")]
        public string Epoch { get; set; }

        [JsonProperty("pretty")]
        public string Pretty { get; set; }

        [JsonProperty("civil")]
        public string Civil { get; set; }

        [JsonProperty("month_name")]
        public string MonthName { get; set; }

        [JsonProperty("month_name_abbrev")]
        public string MonthNameAbbrev { get; set; }

        [JsonProperty("weekday_name")]
        public string WeekdayName { get; set; }

        [JsonProperty("weekday_name_night")]
        public string WeekdayNameNight { get; set; }

        [JsonProperty("weekday_name_abbrev")]
        public string WeekdayNameAbbrev { get; set; }

        [JsonProperty("weekday_name_unlang")]
        public string WeekdayNameUnlang { get; set; }

        [JsonProperty("weekday_name_night_unlang")]
        public string WeekdayNameNightUnlang { get; set; }

        [JsonProperty("ampm")]
        public string Ampm { get; set; }

        [JsonProperty("tz")]
        public string Tz { get; set; }

        [JsonProperty("age")]
        public string Age { get; set; }

        [JsonProperty("UTCDATE")]
        public string Utcdate { get; set; }
    }

    public partial class Wdir
    {
        [JsonProperty("dir")]
        public string Dir { get; set; }

        [JsonProperty("degrees")]
        public string Degrees { get; set; }
    }

    public partial class Response
    {
        [JsonProperty("version")]
        public string Version { get; set; }

        [JsonProperty("termsofService")]
        public string TermsofService { get; set; }

        [JsonProperty("features")]
        public Features Features { get; set; }

        [JsonProperty("error")]
        public Error Error { get; set; }
    }

    public partial class Error
    {
        [JsonProperty("type")]
        public string Type { get; set; }
    }

    public partial class Features
    {
        [JsonProperty("hourly")]
        public long Hourly { get; set; }
    }

    public partial class Weather
    {
        public static Weather FromJson(string json) => JsonConvert.DeserializeObject<Weather>(json, Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this Weather self) => JsonConvert.SerializeObject(self, Converter.Settings);
    }

    public class Converter
    {
        public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
        {
            MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
            DateParseHandling = DateParseHandling.None,
        };
    }
}

As you can see, it generates some methods to convert a string with a JSON to the last object, so with your code it would be like this

public void ProcesaJson{
  var cli = new WebClient();
        string weather = cli.DownloadString(http://api.wunderground.com/api/875ffcffceb88b9c/hourly/es/q/-31.4,-64.1833.json);
        var stuff = Weather.FromJson(weather);

        // usar objeto
        string hora = stuff.HourlyForecast[0].Fcttime.Hour;

}

Make the necessary adaptations such as namespace , make using etc ..

    
answered by 16.01.2018 / 09:03
source
0

Simply use Json.NET:

 dynamic stuff = JsonConvert.DeserializeObject(weather);
 string hora = stuff.Hora;

PS: Check the capitalization of the names of the attributes.

    
answered by 15.01.2018 в 20:12