tjson-spec icon indicating copy to clipboard operation
tjson-spec copied to clipboard

Clarify number formats allowed

Open qligier opened this issue 8 years ago • 0 comments

Hey,

I've read the spec but I'm still not sure what number formats are allowed in integer and floating point types. Based on the Ruby and JS implementations, I think that the only valid formats are:

  • (0|[1-9][0-9]*) for unsigned integers
  • -?(0|[1-9][0-9]*) for signed integers
  • -?(0|[1-9][0-9]*)(.[0-9]*)? for floating points

But the spec says:

Signed integer literals are identified by the "i" tag, with an associated JSON string literal value containing the string representation of a valid JSON integer literal

and

Floating points [...] should use the native JSON syntax

In RFC 7159, valid numbers are defined as number = [ minus ] int [ frac ] [ exp ], so -1e+1=-10 and 3E-2=0.03 are valid JSON numbers, whereas they are not valid in TJSON (?)

Can you please clarify this for me? Thanks!

qligier avatar Oct 20 '17 21:10 qligier