Problem with json.decode

This has been driving me nuts, so thought I'd go ahead and post to see if anyone else has an idea on it! I'm trying to get weather information from wunderground.com and return/decode it with json (which according to their documentation is the preferred method.

1
network.request( "http://api.wunderground.com/api/87198b0e4ee22896/conditions/q/30.54,-97.73.json", "GET", networkListener )

gbailey - Will need to see the json string to help you. But it seems like your json string is malformed..

Thanks Bejoy, I'm including it below. That's what I was thinking too, however if I use the url in Firefox or in a json reader (ie: Jason on my Mac), it comes back ok (ie: is readable).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Runtime error
        Invalid input: '
{
        "response": {
                "version": "0.1"
                ,"termsofService": "http://www.wunderground.com/weather/api/d/terms.html"
                ,"features": {
                "conditions": 1
                }
        }
                ,       "current_observation": {
                "image": {
                "url":"http://icons-ak.wxug.com/graphics/wu2/logo_130x80.png",
                "title":"Weather Underground",
                "link":"http://www.wunderground.com"
                },
                "display_location": {
                "full":"Round Rock, TX",
                "city":"Round Rock",
                "state":"TX",
                "state_name":"Texas",
                "country":"US",
                "country_iso3166":"US",
                "zip":"78681",
                "latitude":"30.540000",
                "longitude":"-97.730000",
                "elevation":"245.00000000"
                },
                "observation_location": {
                "full":"Brushy Creek North Hjornevik's, Round Rock, Texas",
                "city":"Brushy Creek North Hjornevik's, Round Rock",
                "state":"Texas",
                "country":"US",
                "country_iso3166":"US",
                "latitude":"30.541536",
                "longitude":"-97.735313",
                "elevation":"708 ft"
                },
                "estimated": {
                },
                "station_id":"KTXROUND25",
                "observation_time":"Last Updated on December 21, 9:12 AM CST",
                "observation_time_rfc822":"Wed, 21 Dec 2011 09:12:47 -0600",
                "observation_epoch":"1324480367",
                "local_time_rfc822":"Wed, 21 Dec 2011 09:12:50 -0600",
                "local_epoch":"1324480370",
                "local_tz_short":"CST",
                "local_tz_long":"America/Chicago",
                "weather":"Clear",
                "temperature_string":"43.9 F (6.6 C)",
                "temp_f":43.9,
                "temp_c":6.6,
                "relative_humidity":"55%",
                "wind_string":"Calm",
                "wind_dir":"WNW",
                "wind_degrees":289,
                "wind_mph":0.0,
                "wind_gust_mph":0,
                "pressure_mb":"1018.2",
                "pressure_in":"30.07",
                "pressure_trend":"0",
                "dewpoint_string":"29 F (-2 C)",
                "dewpoint_f":29,
                "dewpoint_c":-2,
                "heat_index_string":"NA",
                "heat_index_f":"NA",
                "heat_index_c":"NA",
                "windchill_string":"44 F (7 C)",
                "windchill_f":"44",
                "windchill_c":"7",
                "visibility_mi":"10.0",
                "visibility_km":"16.1",
                "solarradiation":"",
                "UV":"1",
                "precip_1hr_string":"0.00 in ( 0 mm)",
                "precip_1hr_in":"0.00",
                "precip_1hr_metric":" 0",
                "precip_today_string":"0.00 in (0 mm)",
                "precip_today_in":"0.00",
                "precip_today_metric":"0",
                "icon":"clear",
                "icon_url":"http://icons-ak.wxug.com/i/c/k/clear.gif",
                "forecast_url":"http://www.wunderground.com/US/TX/Round_Rock.html",
                "history_url":"http://www.wunderground.com/history/airport/KTXROUND25/2011/12/21/DailyHistory.html",
                "ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=30.541536,-97.735313"
        }
}
'
stack traceback:
        [C]: ?
        [C]: in function '?'
        ?: in function 'Read'
        ?: in function <?:434>
        (tail call): ?
        ?: in function <?:434>
        (tail call): ?
        ?: in function <?:434>
        (tail call): ?
        (tail call): ?
views:1573 update:2011/12/28 9:26:54
corona forums © 2003-2011