After examining the JSON.org railroad (grammar) definition, the number definition provides the negative sign (-), but omits recognizing the positive (+) sign - is this an omission from the diagram, or does JSON disallow postitive sign (+) for numbers?
The exponent allows optional positive (+) and negative (-) signs, so it would seem to save little to provide recognition of (+) for the number...
No, it doesn't.
Besides the grammar on json.org, JSON definitions are also provided by
Concerning notation of signed numbers, they are all consistent. The former has
JSONNumber :: -? DecimalIntegerLiteral JSONFraction? ExponentPart?
while the latter says
number = [ minus ] int [ frac ] [ exp ]
Also all of these specifications allow an optional plus sign in the exponent, but none permits a plus sign to precede the numeric literal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With