mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
Consolidate documentation (#3071)
* 🔥 consolidate documentation * ♻️ overwork std specializations * 🚚 move images files to mkdocs * ♻️ fix URLs * 🔧 tweak MkDocs configuration * 🔧 add namespaces * 📝 document deprecations * 📝 document documentation generation * 🚸 improve search * 🚸 add examples * 🚧 start adding documentation for macros * 📝 add note for https://github.com/nlohmann/json/issues/874#issuecomment-1001699139 * 📝 overwork example handling * 📝 fix Markdown tables
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
# BSON
|
||||
|
||||
BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the JSON spec. For example, BSON has a Date type and a BinData type.
|
||||
BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the
|
||||
embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow
|
||||
representation of data types that are not part of the JSON spec. For example, BSON has a Date type and a BinData type.
|
||||
|
||||
!!! abstract "References"
|
||||
|
||||
@ -12,21 +14,21 @@ BSON, short for Binary JSON, is a binary-encoded serialization of
|
||||
|
||||
The library uses the following mapping from JSON values types to BSON types:
|
||||
|
||||
JSON value type | value/range | BSON type | marker
|
||||
--------------- | --------------------------------- | ----------- | ------
|
||||
null | `null` | null | 0x0A
|
||||
boolean | `true`, `false` | boolean | 0x08
|
||||
number_integer | -9223372036854775808..-2147483649 | int64 | 0x12
|
||||
number_integer | -2147483648..2147483647 | int32 | 0x10
|
||||
number_integer | 2147483648..9223372036854775807 | int64 | 0x12
|
||||
number_unsigned | 0..2147483647 | int32 | 0x10
|
||||
number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12
|
||||
number_unsigned | 9223372036854775808..18446744073709551615| -- | --
|
||||
number_float | *any value* | double | 0x01
|
||||
string | *any value* | string | 0x02
|
||||
array | *any value* | document | 0x04
|
||||
object | *any value* | document | 0x03
|
||||
binary | *any value* | binary | 0x05
|
||||
| JSON value type | value/range | BSON type | marker |
|
||||
|-----------------|-------------------------------------------|-----------|--------|
|
||||
| null | `null` | null | 0x0A |
|
||||
| boolean | `true`, `false` | boolean | 0x08 |
|
||||
| number_integer | -9223372036854775808..-2147483649 | int64 | 0x12 |
|
||||
| number_integer | -2147483648..2147483647 | int32 | 0x10 |
|
||||
| number_integer | 2147483648..9223372036854775807 | int64 | 0x12 |
|
||||
| number_unsigned | 0..2147483647 | int32 | 0x10 |
|
||||
| number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12 |
|
||||
| number_unsigned | 9223372036854775808..18446744073709551615 | -- | -- |
|
||||
| number_float | *any value* | double | 0x01 |
|
||||
| string | *any value* | string | 0x02 |
|
||||
| array | *any value* | document | 0x04 |
|
||||
| object | *any value* | document | 0x03 |
|
||||
| binary | *any value* | binary | 0x05 |
|
||||
|
||||
!!! warning "Incomplete mapping"
|
||||
|
||||
@ -53,28 +55,28 @@ binary | *any value* | binary | 0x05
|
||||
|
||||
The library maps BSON record types to JSON value types as follows:
|
||||
|
||||
BSON type | BSON marker byte | JSON value type
|
||||
--------------- | ---------------- | ---------------------------
|
||||
double | 0x01 | number_float
|
||||
string | 0x02 | string
|
||||
document | 0x03 | object
|
||||
array | 0x04 | array
|
||||
binary | 0x05 | binary
|
||||
undefined | 0x06 | *unsupported*
|
||||
ObjectId | 0x07 | *unsupported*
|
||||
boolean | 0x08 | boolean
|
||||
UTC Date-Time | 0x09 | *unsupported*
|
||||
null | 0x0A | null
|
||||
Regular Expr. | 0x0B | *unsupported*
|
||||
DB Pointer | 0x0C | *unsupported*
|
||||
JavaScript Code | 0x0D | *unsupported*
|
||||
Symbol | 0x0E | *unsupported*
|
||||
JavaScript Code | 0x0F | *unsupported*
|
||||
int32 | 0x10 | number_integer
|
||||
Timestamp | 0x11 | *unsupported*
|
||||
128-bit decimal float | 0x13 | *unsupported*
|
||||
Max Key | 0x7F | *unsupported*
|
||||
Min Key | 0xFF | *unsupported*
|
||||
| BSON type | BSON marker byte | JSON value type |
|
||||
|-----------------------|------------------|-----------------|
|
||||
| double | 0x01 | number_float |
|
||||
| string | 0x02 | string |
|
||||
| document | 0x03 | object |
|
||||
| array | 0x04 | array |
|
||||
| binary | 0x05 | binary |
|
||||
| undefined | 0x06 | *unsupported* |
|
||||
| ObjectId | 0x07 | *unsupported* |
|
||||
| boolean | 0x08 | boolean |
|
||||
| UTC Date-Time | 0x09 | *unsupported* |
|
||||
| null | 0x0A | null |
|
||||
| Regular Expr. | 0x0B | *unsupported* |
|
||||
| DB Pointer | 0x0C | *unsupported* |
|
||||
| JavaScript Code | 0x0D | *unsupported* |
|
||||
| Symbol | 0x0E | *unsupported* |
|
||||
| JavaScript Code | 0x0F | *unsupported* |
|
||||
| int32 | 0x10 | number_integer |
|
||||
| Timestamp | 0x11 | *unsupported* |
|
||||
| 128-bit decimal float | 0x13 | *unsupported* |
|
||||
| Max Key | 0x7F | *unsupported* |
|
||||
| Min Key | 0xFF | *unsupported* |
|
||||
|
||||
!!! warning "Incomplete mapping"
|
||||
|
||||
|
Reference in New Issue
Block a user