mirror of
https://github.com/nlohmann/json.git
synced 2025-07-31 10:24:23 +03:00
Support BSON uint64 de/serialization (#4590)
* Support BSON uint64 de/serialization Signed-off-by: Michael Valladolid <mikevalladolid@gmail.com> * Treat 0x11 as uint64 and not timestamp specific Signed-off-by: Michael Valladolid <mikevalladolid@gmail.com> --------- Signed-off-by: Michael Valladolid <mikevalladolid@gmail.com>
This commit is contained in:
committed by
GitHub
parent
1809b3d800
commit
2d42229f4d
@ -23,7 +23,7 @@ The library uses the following mapping from JSON values types to BSON types:
|
||||
| number_integer | 2147483648..9223372036854775807 | int64 | 0x12 |
|
||||
| number_unsigned | 0..2147483647 | int32 | 0x10 |
|
||||
| number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12 |
|
||||
| number_unsigned | 9223372036854775808..18446744073709551615 | -- | -- |
|
||||
| number_unsigned | 9223372036854775808..18446744073709551615 | uint64 | 0x11 |
|
||||
| number_float | *any value* | double | 0x01 |
|
||||
| string | *any value* | string | 0x02 |
|
||||
| array | *any value* | document | 0x04 |
|
||||
@ -73,7 +73,7 @@ The library maps BSON record types to JSON value types as follows:
|
||||
| Symbol | 0x0E | *unsupported* |
|
||||
| JavaScript Code | 0x0F | *unsupported* |
|
||||
| int32 | 0x10 | number_integer |
|
||||
| Timestamp | 0x11 | *unsupported* |
|
||||
| uint64(Timestamp) | 0x11 | number_unsigned |
|
||||
| 128-bit decimal float | 0x13 | *unsupported* |
|
||||
| Max Key | 0x7F | *unsupported* |
|
||||
| Min Key | 0xFF | *unsupported* |
|
||||
@ -94,3 +94,8 @@ The library maps BSON record types to JSON value types as follows:
|
||||
```json
|
||||
--8<-- "examples/from_bson.output"
|
||||
```
|
||||
|
||||
!!! note "Handling of BSON type 0x11"
|
||||
|
||||
BSON type 0x11 is used to represent uint64 numbers. This library treats these values purely as uint64 numbers
|
||||
and does not parse them into date-related formats.
|
@ -839,7 +839,7 @@ A parsed number could not be stored as without changing it to NaN or INF.
|
||||
|
||||
### json.exception.out_of_range.407
|
||||
|
||||
UBJSON and BSON only support integer numbers up to 9223372036854775807.
|
||||
UBJSON only support integer numbers up to 9223372036854775807.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
|
Reference in New Issue
Block a user