Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18066
| From | Stefan Weiss <krewecherl@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Handling numbers via JSON.parse Q's? |
| Date | 2013-01-11 03:45 +0100 |
| Organization | albasani.net |
| Message-ID | <kcnuc6$ejp$1@news.albasani.net> (permalink) |
| References | <6ftue85iefl7i6g4vfo0jnvjnl1nter0fs@4ax.com> |
On 2013-01-11 03:37, BobMCT wrote:
> My json string looks like this:
> {"_stat":null,"_desc":"Powerball","_url":"www.ctlottery.org","_mdup":"N","_bdup":"N","_maxe":"5","_minn":"1","_maxn":"59","_bmaxe":"1","_bminn":"1","_bmaxn":"35"}
>
> and my instruction to extract the values into an associative array is:
> Ginfo = JSON.parse(xmlhttp.responseText);
>
> However, when I try to extract a numeric value using the following
> instruction:
>
> _maxe = Number(Ginfo['_maxe']);
>
> it appears that the field _maxe is NULL. Also, when I try to show its
> value with an alert('_maxe = ' + _maxe);
> the value displayed is NaN (Not a Number.
What you've described should work, so there's something else going on.
Maybe xmlhttp.responseText doesn't contain what you think it does?
- stefan
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Handling numbers via JSON.parse Q's? BobMCT <r.mariotti@fdcx.net> - 2013-01-10 21:37 -0500
Re: Handling numbers via JSON.parse Q's? Stefan Weiss <krewecherl@gmail.com> - 2013-01-11 03:45 +0100
Re: Handling numbers via JSON.parse Q's? Denis McMahon <denismfmcmahon@gmail.com> - 2013-01-11 08:39 +0000
Re: Handling numbers via JSON.parse Q's? Denis McMahon <denismfmcmahon@gmail.com> - 2013-01-11 09:22 +0000
Re: Handling numbers via JSON.parse Q's? BobMCT <r.mariotti@fdcx.net> - 2013-01-11 21:02 -0500
csiph-web