Skip to content

Commit fda916c

Browse files
Further fix documentation incorrectly saying that JSON spec has C++ style coercion semantics instead of parse-fail on too-large numbers.
PiperOrigin-RevId: 847861573
1 parent 1f9119f commit fda916c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

content/programming-guides/json.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,14 @@ that the relevant clients set an Ignore Unknown Fields flag, discussed
363363
`sfixed32`, `fixed32`) and any of the 64-bit integers ( `int64`, `uint64`,
364364
`sint64`, `sfixed32`) is a compatible change.
365365
* If a number is parsed from the wire that doesn't fit in the
366-
corresponding type, you will get the same effect as if you had cast the
367-
number to that type in C++ (for example, if a 64-bit number is read as
368-
an int32, it will be truncated to 32 bits).
366+
corresponding type, a parse failure will occur.
369367
* Unlike binary wire format, `bool` is not compatible with integers.
370-
* Note that the int64 types are quoted by default to avoid precision loss
371-
when handled as a double or JavaScript number, and the 32 bit types are
372-
unquoted by default. Conformant implementations will accept either case
373-
for all integer types, but nonconformant implementations may mishandle
374-
this case and not handle quoted int32s or unquoted int64s which may
375-
break under this change.
368+
* Note that the int64 and uint64 types are quoted by default to avoid
369+
precision loss when handled as a double or JavaScript number, and the 32
370+
bit types are unquoted by default. Conformant parsers will accept either
371+
quoted or unquoted for all integer types, but nonconformant
372+
implementations may mishandle this case and not handle quoted-int32s or
373+
unquoted-int64s, so caution should be taken.
376374
* `enum` may be conditionally compatible with `string`
377375
* If "enums-as-ints" flag is used by any client, then enums will instead
378376
be compatible with the integer types instead.

0 commit comments

Comments
 (0)