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

  • SEARCH
  • Home
  • 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 7567227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:36:45+00:00 2026-05-30T14:36:45+00:00

I have this json response and I’m trying to walke thought it to get

  • 0

I have this json response and I’m trying to walke thought it to get the weather conditions such as “humidity” and “temp_C” and so on. I tried some ways but didn’t work.

({ "data" : { "current_condition" : [ { "cloudcover" : "50",
            "humidity" : "44",
            "observation_time" : "12:10 AM",
            "precipMM" : "0.0",
            "pressure" : "1013",
            "temp_C" : "-2",
            "temp_F" : "29",
            "visibility" : "16",
            "weatherCode" : "116",
            "weatherDesc" : [ { "value" : "Partly Cloudy" } ],
            "weatherIconUrl" : [ { "value" : "http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0004_black_low_cloud.png" } ],
            "winddir16Point" : "W",
            "winddirDegree" : "280",
            "windspeedKmph" : "24",
            "windspeedMiles" : "15"
          } ],
      "request" : [ { "query" : "Rochester, United States Of America",
            "type" : "City"
          } ],
      "weather" : [ { "date" : "2012-02-25",
            "precipMM" : "2.2",
            "tempMaxC" : "-1",
            "tempMaxF" : "31",
            "tempMinC" : "-5",
            "tempMinF" : "24",
            "weatherCode" : "116",
            "weatherDesc" : [ { "value" : "Partly Cloudy" } ],
            "weatherIconUrl" : [ { "value" : "http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0002_sunny_intervals.png" } ],
            "winddir16Point" : "W",
            "winddirDegree" : "281",
            "winddirection" : "W",
            "windspeedKmph" : "54",
            "windspeedMiles" : "34"
          } ]
    } })

I tried these:

$.getJSON(urlFromMyAPI, function (data) {
    alert(data.current_condition.temp_C);
    alert(data.temp_C);
    alert(data[current_condition].temp_C);
    // I also use loop
    for (i = 0; i <= 3; i++) {
        alert(data.current_condition[i])
    }
});
};
  • 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-30T14:36:46+00:00Added an answer on May 30, 2026 at 2:36 pm

    I think your main issue is that your data is nested inside an object named data so you need an extra level of reference to get inside it. It’s also a lot easier to see what you’ve got when you format your response like this so you can see the nested objects and arrays more clearly:

    ({ "data": { 
        "current_condition": [ 
            {
                "cloudcover": "50", 
                "humidity": "44", 
                "observation_time": "12:10 AM", 
                "precipMM": "0.0", 
                "pressure": "1013", 
                "temp_C": "-2", 
                "temp_F": "29", 
                "visibility": "16", 
                "weatherCode": "116",  
                "weatherDesc": [ 
                    {"value": "Partly Cloudy" } 
                ],  
                "weatherIconUrl": [ 
                    {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0004_black_low_cloud.png" } 
                ], 
                "winddir16Point": "W", 
                "winddirDegree": "280", 
                "windspeedKmph": "24", 
                "windspeedMiles": "15" 
            } 
        ],  
        "request": [ 
            {"query": "Rochester, United States Of America", "type": "City" } 
        ],  
        "weather": [
            {
                "date": "2012-02-25", 
                "precipMM": "2.2", 
                "tempMaxC": "-1", 
                "tempMaxF": "31", 
                "tempMinC": "-5", 
                "tempMinF": "24", 
                "weatherCode": "116",  
                "weatherDesc": [ 
                    {"value": "Partly Cloudy" } 
                ],  
                "weatherIconUrl": [
                    {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png" } 
                ], 
                "winddir16Point": "W", 
                "winddirDegree": "281", 
                "winddirection": "W", 
                "windspeedKmph": "54", 
                "windspeedMiles": "34" 
            } 
        ] 
    }
    })
    

    That said, if you want to get the current condition temp_C, it would be like this (note I changed the argument name for your anonymous function to make the code less confusing):

    $.getJSON( urlFromMyAPI, function(response){
        var temp = response.data.current_condition[0].temp_C;
    });
    

    If you want the temp as a number, you may need to do this:

    $.getJSON( urlFromMyAPI, function(response){
        var temp = parseInt(response.data.current_condition[0].temp_C, 10);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse Json response from This URL . I have used
I have this JSON response string: {d:{\ID_usuario\:\000130\,\Nombre\:null,\Vipxlo\:0,\Provmun\:null,\Descuentos\:null,\Listaviplocal\:null}}` With this code: - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
If i have this json response {error:repeated} Why the alert is not showed? It
I have this NodeJS app which fetches JSON-type response from a web application and
I have this example where I am trying to access json value, but it
i have this json response: [{ i: 39, id: 15399 }, { i: 38,
I have Json response from my database . I am using Php for this
I am new on JQuery. I have this JSON response from the server how
I have this json string by getting a response from using singleton client(RestKit). [
I have an issue with Json response and accent characters. I have this pice

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.