0

I am pulling .json info from weatherunderground into Flash CC. After I parse the data I am left with the following variables:

Flash Variables

I am trying to get to the "conditions" variable. But I can't get there because of the integer/number "0" How do I format it?

This is my code:

function completeHandler(event: Event): void 
{
    var loader1: URLLoader = URLLoader(event.target);

    var data1: Object = JSON.parse(loader1.data);

    trace(data1.forecast.simpleforecast.forecastday.0.conditions);
}

This works for variables that don't have an integer in their path.

1 Answer 1

1

forecastday is an array, which you can see in the Value column ([] (@...). The JSON is just telling you what is contained in each element of the array, so just use data1.forecast.simpleforecast.forecastday[0].conditions, or loop through for each day.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.