How Do I Get a JSON Object Instead of an XML Object from Your Weather API?

Tagged:

Currently contains 5 posts

Avatar

January 04, 2019 20:58

ID Coder

Hi, I’m a web developer working on a weather app. When I use my provided APP ID and API key, I get an XML object. I would like, instead, to get a JSON object. How is this possible? Thanks in advance for your help! Please send any emails to gebremesquitta@gmail.com.

Avatar

January 18, 2019 17:17

Daryl Dyck

Did you figure this out?

Avatar

June 01, 2019 09:18

Varun Kumar

How to get please answer

Avatar

June 05, 2019 08:53

Dennis Maidon

This is the Vb.Net code I use to get a JSON object:

Dim url = $“http://api.weatherunlocked.com/api/forecast/us.{Zipcode}?app_id={AppId}&app_key={AppKey}”
Dim client = New HttpClient()
With client.DefaultRequestHeaders
.UserAgent.ParseAdd(USE_AGENT)
.AcceptEncoding.Add(New StringWithQualityHeaderValue(“gzip”))
.Accept.Add(New MediaTypeWithQualityHeaderValue(“application/json”))
End With
client.DefaultRequestHeaders.UserAgent.ParseAdd(USE_AGENT)
Dim rb = Await client.GetStringAsync(New Uri(url))

Avatar

November 28, 2019 14:39

Manon Heine

to get a json object, I wrote in vanilla javascript:

getWeather()
.then(response => {
console.log(“success!”);
})
.catch(error => {
console.log(error);
console.error(error);
});

async function getWeather() { const response = await fetch(url); const results = await response.json(); console.log(results); doSomething(results); }

all this happens inside a function on submit, which creates my url. Url looks like:

let url = “https://api.weatherunlocked.com/api/resortforecast/” + resortID + “?num_of_days=3&app_id=” + appID + “&app_key=” + apiKey;

Reply to thread
  1. If you're human, leave this field empty.