.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "BSON_AS_JSON_WITH_OPTS" "3" "May 02, 2024" "1.27.0" "libbson" .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX char * bson_as_json_with_opts (const bson_t *bson, size_t *length, const bson_json_opts_t *opts); .EE .UNINDENT .UNINDENT .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBbson\fP: A \fI\%bson_t\fP\&. .IP \(bu 2 \fBlength\fP: An optional location for the length of the resulting string. .IP \(bu 2 \fBopts\fP: A \fI\%bson_json_opts_t\fP\&. .UNINDENT .SH DESCRIPTION .sp The \fI\%bson_as_json_with_opts()\fP encodes \fBbson\fP as a UTF\-8 string in the \fI\%MongoDB Extended JSON format\fP\&. .sp The caller is responsible for freeing the resulting UTF\-8 encoded string by calling \fI\%bson_free()\fP with the result. .sp If non\-NULL, \fBlength\fP will be set to the length of the result in bytes. .sp The \fBopts\fP structure is used to pass options for the encoding process. Please refer to the documentation of \fI\%bson_json_opts_t\fP for more details. .SH RETURNS .sp If successful, a newly allocated UTF\-8 encoded string and \fBlength\fP is set. .sp Upon failure, NULL is returned. .SH EXAMPLE .INDENT 0.0 .INDENT 3.5 .sp .EX bson_json_opts_t *opts = bson_json_opts_new (BSON_JSON_MODE_CANONICAL, BSON_MAX_LEN_UNLIMITED); char *str = bson_as_json_with_opts (doc, NULL, opts); printf (\(dq%s\en\(dq, str); bson_free (str); bson_json_opts_destroy (opts); .EE .UNINDENT .UNINDENT .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .