xcode - Trouble with nested Json data -
I have a ton of trouble trying to reach nested JSON data (pasted below). I am writing: "Create a dictionary with data within the data" as the NSDictionary
as the
However, Xcode will not allow me to call anything within "current_condition" such as "data". I have tried to do the current_ condition as if This is your own dictionary:
var result = data result ["current_condition"] as NSDictionary but it appears that It is changing to blue form.
I have also tried to use the standard method to call nested loops:
var Detreshte ults = JSONSUSTT [ "Data"] ["Current Connection"] as NSDictionary but it results in a compiler error.
Any help? Very much appreciated!
Jason data:
{data = {"current_condition" = ({cloudcover = 0; humidity = 68; "observation_time" = "01:39 am"; "=" 0.0 "; Pressure = 1017; "Temp_C" = 20; "Temp_F" = 68; Visibility = 10; Weather code = 143; WeatherDisk = ({value = mist;}); WeatherIconUrl = ({value = "http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0006_mist.png";}); Winddir16Point = NE; WinddirDegree = 50; WindspeedKmph = 7; WindspeedMiles = 4;}); Request = ({query = "London, United Kingdom"; type = city;}); Weather = ({date = "2014-07-25"; precipMM = "1.5"; tempMaxC = 27; tempMaxF = 81; tempMinC = 14; tempMinF = 57; weatherCode = 353; weatherDesc = ({value = "light rain Shower ";}); weatherIconUrl = ({value =" http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0009_light_rain_showers.png ";}); winddir16point = NE; winddirDegree = 54; winddirection = NE; windspeedKmph = 15 ; WindspeedMiles = 10;} {date = "2014-07-26"; precipMM = "5.8", tempMaxC = 28; tempMaxF = 83; tempMinC = 16; tempMinF = 61; weatherCode = 176; weatherDesc = ({value = " Scattered rain nearby ";}); weatherIconUrl = ({value =" http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0009_light_rain_showers.png ";}); winddir16Point = NNE; winddirDegree = 12; winddirection = NNE ; WindspeedKmph = 11; windspeedMiles = 7;} {date = "2014-07-27"; precipMM = "0.2", tempMaxC = 26; tempMaxF = 80; temp MinC = 13; tempMinF = 55; weatherCode = 116; weatherDesc = ({value = "partially blurred";}); WeatherIconUrl = ({value = "http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0002_sunny_intervals .png "; }); Winddir16Point = NW; WinddirDegree = 321; Wind Direction = NW; WindspeedKMP = 14; Windsales Miles = 9; }, {Date = "2014-07-28"; PRESIMMM = "1.9"; TempMaxC = 26; TempMaxF = 78; TempMinC = 12; TempMinF = 54; Weather code = 116; WeatherDesc = ({value = "partially blurred";}); WeatherIconUrl = ({value = "http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0002_sunny_intervals.png";}); Winddir16Point = N; WinddirDegree = 351; Winddraction = n; WindspeedKMP = 13; Windsales Miles = 8; }, {Date = "2014-07-29"; PRESIMM = "0.0"; TempMaxC = 28; TempMaxF = 82; TempMinC = 16; TempMinF = 60; Weathercode = 113; WeatherDesc = ({value = Sunny;}); WeatherIconUrl = ({value = "http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0001_sunny.png";}); Winddir16Point = NNW; Winddairgrade = 329; Wind Direction = NW; WindspeedKMP = 13; Windsales Miles = 8; }); }; }
Strangely, I have a sample weather The app that I switched into Swift, I get my data elsewhere, but this library is a great way to deal with JSON in Swift: very clean and easy.
Comments
Post a Comment