Rogue < in API output of <prob_precip_pct> string

Tagged:

Currently contains 4 posts

Avatar

October 27, 2015 13:57

Dave Thackeray

Hi folks.

New user of this awesome tool.

Parsed XML to JSON and discovered that in each <prob_precip_pct> instance the API renders:

<prob_precip_pct><1</prob_precip_pct>

The rogue < needs removing. Can this be done – or is this something we users need to sort?

Thank you!

Dave

Avatar

October 27, 2015 14:20

John Armstrong

Hi Dave,

We are very pleased you think the app is good. Any further feedback would be most welcome.

To answer your question and the ‘<1’ is a string and it means ‘less than 1%’. It is explained in the documentation – though going over the doc and it could be explained better – we’ll amend. You can see what it currently says in the docs here;

https://developer.weatherunlocked.com/documentation/localweather/resources#descriptions

If we can help further please don’t hesitate getting straight back to us.

Many thanks,

John.

Avatar

October 27, 2015 16:30

Dave Thackeray

The reason I brought this up was I got an error when trying to parse the XML as JSON.

“#text”: “error on line 198 at column 19: StartTag: invalid element name”

from

http://www.utilities-online.info/xmltojson/#.Vi-B0bfhBhE

Any thoughts how we might overcome this?

Dave

Avatar

October 27, 2015 17:23

John Armstrong

Hi Dave,

We’ll get to the bottom of this for you. First off though I need to ask why you are parsing from XML to JSON? We provide a ready made JSON output option meaning you would have no need to parse from XML.

To specify the json output format, set the “Accept” header to “application/json”

https://developer.weatherunlocked.com/documentation/localweather

Or is there is a specific reason you need to request the data in XML format? If so we’d be interested to know what this need was and look to provide a suitable solution for you.

Cheers,

John.

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