Provided by: libbson-doc_1.3.1-1_all
NAME
JSON - None
CONVERTING BSON TO JSON
There are often times where you might want to convert a BSON document to JSON. It is convenient for debugging as well as an interchange format. To help with this, Libbson contains the function bson_as_json(3) \&.
CONVERTING JSON TO BSON
Converting back from JSON is also useful and common enough that we added bson_init_from_json(3) and bson_new_from_json(3) \&. The following example creates a new bson_t from the JSON string {"a":1} \&.
STREAMING JSON PARSING
Libbson provides bson_json_reader_t to allow for parsing a sequence of JSON documents into BSON. The interface is similar to bson_reader_t but expects the input to be in the MongoDB extended JSON format.
EXAMPLES
The following example reads BSON documents from stdin and prints them to stdout as JSON.
COLOPHON
This page is part of libbson. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.