bson_new_from_json (3) - Linux Manuals
bson_new_from_json: The bson_new_from_json() function allocates and initialize a new bson_t by parsing the JSON found in data. Only a single JSON object may exist in data or an error will be set and NULL returned.
Command to display bson_new_from_json
manual in Linux: $ man 3 bson_new_from_json
NAME
bson_new_from_json() - The bson_new_from_json() function allocates and initialize a new bson_t by parsing the JSON found in data. Only a single JSON object may exist in data or an error will be set and NULL returned.
SYNOPSIS
bson_t *
bson_new_from_json (const uint8_t *data,
ssize_t len,
bson_error_t *error);
PARAMETERS
- data
-
A UTF-8 encoded string containing valid JSON.
- len
-
The length of
data
in bytes excluding a trailing
\0
or -1 to determine the length with
strlen(3)
\&.
- error
-
An optional location for a
bson_error_t
\&.
DESCRIPTION
The
bson_new_from_json(3)
function allocates and initialize a new
bson_t
by parsing the JSON found in
data
\&. Only a single JSON object may exist in
data
or an error will be set and NULL returned.
ERRORS
Errors are propagated via the
error
parameter.
RETURNS
A newly allocated
bson_t
if successful, otherwise NULL and
error
is set.
COLOPHON
This page is part of libbson.
Please report any bugs at
https://jira.mongodb.org/browse/CDRIVER.
Pages related to bson_new_from_json
- bson_new_from_buffer (3) - TODO:
- bson_new_from_data (3) - The bson_new_from_data() function shall create a new bson_t on the heap and copy the contents of data. This may be helpful when working with language bindings but is generally expected to be slower.
- bson_new (3) - The bson_new() function shall create a new bson_t structure on the heap. It should be freed with bson_destroy() when it is no longer in use.
- bson_append_array (3) - The bson_append_array() function shall append child to bson using the specified key. The type of the field will be an array, but it is the responsibility of the caller to ensure that the keys of child are properly formatted with string keys such as "0", "1", "2" and so forth.
- bson_append_array_begin (3) - The bson_append_array_begin() function shall begin appending an array field to bson. This allows for incrementally building a sub-array. Doing so will generally yield better performance as you will serialize to a single buffer. When done building the sub-array, the caller MUST call bson_append_array_end().
- bson_append_array_end (3) - The bson_append_array_end() function shall complete the appending of an array field started with bson_append_array_begin(). child is invalid after calling this function.
- bson_append_binary (3) - The bson_append_binary() function shall append a new element to bson containing the binary data provided.
- bson_append_bool (3) - The bson_append_bool() function shall append a new element to bson containing the boolean provided.
- bson_append_code (3) - The bson_append_code() function shall append a new element to bson using the UTF-8 encoded javascript provided. javascript must be a NULL terminated C string.