On Aug 16, 3:27 pm, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> Yep, that's a feature of JavaScript. No quotes means it's a number, not a
> string, and numbers that start with 0 are assumed to be octal (base 8). Even
> parseInt("063") will give you 51, since again, it assumes you mean octal.
>
> I suggest you either strip of the leading zero on the server side, and allow
> it to transmit as a number (no quotes), or wrap it in quotes and pull it out
> with parseInt("063", 10) to force it to do base 10.

The OP may run into additional problems if he has numbers like 099,
which is syntactically octal but not a legal octal value.

> Terry wrote:
> I would rather not have to re-write my sql to force " " in it but want
> JSON to recognize this as a string value and numeric.

You can have one or the other. JSON is only a simple data format and
doesn't have any brains attached to it at all, so i can't know "this
is both a number and a string." The parseInt(...,10) which Erik
mentioned is probably your best/safest bet, especially if you have
numbers which aren't legal octal values (see above).

Reply via email to