Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting at Json variables
    primarykey
    data
    text
    <p>I have the following json data:</p> <pre><code>var JSONObject2= { "weather": { "curren_weather": [ { "humidity": "69", "pressure": "1012", "temp": "70", "temp_unit": "f", "weather_code": "1", "weather_text": "Mostly cloudy", "wind": [ { "dir": "Not Available", "speed": "0", "wind_unit": "mph" } ] } ], "forecast": [ { "date": "2012-08-21", "day": [ { "weather_code": "0", "weather_text": "Sunny skies", "wind": [ { "dir": "NW", "dir_degree": "311", "speed": "7", "wind_unit": "mph" } ] } ], "day_max_temp": "83", "night": [ { "weather_code": "0", "weather_text": "Clear skies", "wind": [ { "dir": "WNW", "dir_degree": "289", "speed": "7", "wind_unit": "mph" } ] } ], "night_min_temp": "57", "temp_unit": "f" }, { "date": "2012-08-22", "day": [ { "weather_code": "0", "weather_text": "Sunny skies", "wind": [ { "dir": "N", "dir_degree": "7", "speed": "4", "wind_unit": "mph" } ] } ], "day_max_temp": "85", "night": [ { "weather_code": "0", "weather_text": "Clear skies", "wind": [ { "dir": "S", "dir_degree": "176", "speed": "7", "wind_unit": "mph" } ] } ], "night_min_temp": "63", "temp_unit": "f" } ] } }; </code></pre> <p>On very simple json data, I can figure out how to get at the variables. On something like the above, it is difficult for me. </p> <p>So to access say where the temp is 70, I would code: var my_temp= weather.curren_weather.temp // This does not work</p> <p>So just as 2 examples how would I get at the temp(70) and say where the wind_degree is 311?</p> <p>Also is there a program where you can paste in the json object like the above and it will output the correct code needed to access any variable?</p> <p>Thanks, Jim</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload