-0 gets rejected as a number (error: "No digits after initial minus") #88

briancsinger opened this Issue Jul 26, 2011 · 1 comment

2 participants


Parser rejects -0 as a legitimate number. Unless I'm reading the specs wrong, a json number is:
number = [ minus ] int [ frac ] [ exp ]

and an int is:
int = zero / ( digit1-9 *DIGIT )

I'm referencing: http://www.ietf.org/rfc/rfc4627.txt

A fairly easy workaround that I'm currently using is to replace -0 with 0 and then parsing. That's working for me.

(If you need some sample json strings I'm happy to provide)

@stig stig added a commit that closed this issue Jul 27, 2011
@stig Parse -0 correctly. Fixes #88. 4355df0
@stig stig closed this in 4355df0 Jul 27, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment