Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7035467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:18:27+00:00 2026-05-28T01:18:27+00:00

I am trying to get json data but I am not able to do

  • 0

I am trying to get json data but I am not able to do so. I am trying to get weather data for a specific city. Here is my json data

{ 
"data": 
{ 
    "current_condition": 
    [ 
        {
            "cloudcover": "100", 
            "humidity": "100", 
            "observation_time": "01:07 PM", 
            "precipMM": "0.2", 
            "pressure": "993", 
            "temp_C": "-6", 
            "temp_F": "21", 
            "visibility": "10", 
            "weatherCode": "368",  
            "weatherDesc": 
            [ 
                {
                    "value": "Light snow showers" 
                } 
            ],  
            "weatherIconUrl": 
            [ 
                {
                    "value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0027_light_snow_showers_night.png" 
                } 
            ], 
            "winddir16Point": "N", 
            "winddirDegree": "360", 
            "windspeedKmph": "9", 
            "windspeedMiles": "6"
        } 
    ],  
    "request": 
    [ 
        {
            "query": "Tampere, Finland", 
            "type": "City" 
        } 
    ],  
    "weather": 
    [ 
        {
            "date": "2012-01-07", 
            "precipMM": "2.3", 
            "tempMaxC": "-4", 
            "tempMaxF": "25", 
            "tempMinC": "-8", 
            "tempMinF": "17", 
            "weatherCode": "326",  
            "weatherDesc": 
            [ 
                {
                    "value": "Light snow" 
                } 
            ],  
            "weatherIconUrl": 
            [ 
                {
                    "value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0011_light_snow_showers.png" 
                } 
            ], 
            "winddir16Point": "NNW", 
            "winddirDegree": "336", 
            "winddirection": "NNW", 
            "windspeedKmph": "9", 
            "windspeedMiles": "5" 
        }, 
        {
            "date": 
            "2012-01-08", 
            "precipMM": "0.0", 
            "tempMaxC": "-7", 
            "tempMaxF": "19", 
            "tempMinC": "-9", 
            "tempMinF": "17", 
            "weatherCode": "116",  
            "weatherDesc": 
            [ 
                {
                    "value": "Partly Cloudy" 
                } 
            ],  
            "weatherIconUrl": 
            [ 
                {
                    "value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png" 
                } 
            ], 
            "winddir16Point": "SSE", 
            "winddirDegree": "148", 
            "winddirection": "SSE", 
            "windspeedKmph": "5", 
            "windspeedMiles": "3" 
        } 
    ] 
}
}

and here is how I am trying to get it using jquery

var container = $('.weatherContainer');
        var url = 'http://free.worldweatheronline.com/feed/weather.ashx?q=Tampere&format=json&num_of_days=2&key=a84523bbed133415120701&callback=?';
        $.getJSON(url, function(w) {
            //console.log(w.data);
            var contents = "<div class='c'>";
            $.each(w.data, function(i, res){
                //alert('h');
                $.each(res.weather, function(j,action) {
                    //alert('i');
                    contents += "<section>" + action.tempMaxC + "</section>";
                });
            });
            contents += "</div>";
            container.append(contents);
        });

Help please. How can I achieve it? Above code doesnt work for me.

Here what the error is

object is undefined
length = object.length,                                   jquery-latest.js (line 630) 

I want to get the data inside the weather object. How can I get that?

Ok here is the image of output when I uncomment console.log enter link description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:18:28+00:00Added an answer on May 28, 2026 at 1:18 am

    Your problem is your nested “each” loops. You are telling jQuery for each object in the response’s data object, find each weather object inside of those and iterate over it. There is only one weather object and it’s directly inside of data, so remove the outer loop and simplify with this single loop:

    $.each(w.data.weather, function(i, res) {        
        contents += "<section>" + res.tempMaxC + "</section>";
    });
    

    All in all, you were pretty close. Here’s a working fiddle of your code with the minor change.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just trying to extract json response data using jmeter but not able
I am trying this to get json object but it does not seem to
I'm trying to get JSON data to turn it into html but the JSON
While trying to GET a JSON, my callback function is NOT firing. $.ajax({ type:GET,
I am able to send data to the server using JSON and get back
Trying to get a JSON output to work with jqGrid 'userdata' option. The example
I am trying to get some errors returned in JSON format. So, I made
Trying to get an ASP application deployed; it worked for a while but then
I'm trying to get my head around the dbpedia JSON schema and can't figure
I have the following JSON: {COLUMNS:[ID,FIRSTNAME],DATA:[[1,Steve],[2,Jim],[3,Bill],[4,Tony]]} I am trying to write some jQuery that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.