1BSON_NEW_FROM_JSON(3)               libbson              BSON_NEW_FROM_JSON(3)
2
3
4

SYNOPSIS

6          bson_t *
7          bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error);
8

PARAMETERS

10data: A UTF-8 encoded string containing valid JSON.
11
12len: The length of data in bytes excluding a trailing \0 or -1 to de‐
13         termine the length with strlen().
14
15error: An optional location for a bson_error_t.
16

DESCRIPTION

18       The bson_new_from_json()  function  allocates  and  initializes  a  new
19       bson_t  by  parsing  the JSON found in data.  Only a single JSON object
20       may exist in data or an error will be set and NULL returned.
21
22       Deprecated behavior: If there are  multiple  comma-separated  JSONs  in
23       data, the keys from all JSONs are merged in the returned BSON.  For ex‐
24       ample, {"a": 1},{"b": 2} is parsed as {"a": 1, "b": 2}.  If  the  first
25       character  encountered  after the last valid JSON object is {, all fol‐
26       lowing characters are ignored and no error is set.  Otherwise, an error
27       will be set and NULL returned.  Errors ------
28
29       Errors are propagated via the error parameter.
30

RETURNS

32       A  newly  allocated  bson_t  if successful, otherwise NULL and error is
33       set.
34

AUTHOR

36       MongoDB, Inc
37
39       2017-present, MongoDB, Inc
40
41
42
43
441.25.1                           Nov 08, 2023            BSON_NEW_FROM_JSON(3)
Impressum