1BSON_INIT_FROM_JSON(3) libbson BSON_INIT_FROM_JSON(3)
2
3
4
6 bson_init_from_json - bson_init_from_json()
7
9 bool
10 bson_init_from_json (bson_t *bson,
11 const char *data,
12 ssize_t len,
13 bson_error_t *error);
14
16 • bson: Pointer to an uninitialized bson_t.
17
18 • data: A UTF-8 encoded string containing valid JSON.
19
20 • len: The length of data in bytes excluding a trailing \0 or -1 to de‐
21 termine the length with strlen().
22
23 • error: An optional location for a bson_error_t.
24
26 The bson_init_from_json() function will initialize a new bson_t by
27 parsing the JSON found in data. Only a single JSON object may exist in
28 data or an error will be set and false returned.
29
30 data should be in MongoDB Extended JSON format.
31
33 Errors are propagated via the error parameter.
34
36 Returns true if valid JSON was parsed, otherwise false and error is
37 set. On success, bson is initialized and must be freed with bson_de‐
38 stroy, otherwise bson is invalid.
39
41 MongoDB, Inc
42
44 2017-present, MongoDB, Inc
45
46
47
48
491.17.6 Jun 03, 2021 BSON_INIT_FROM_JSON(3)