---
name: "bson_json_opts_t"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_json_opts_t"
---

# bson\_json\_opts\_t(3)

BSON to JSON encoding options

## SYNOPSIS

```
#include <bson/bson.h>
typedef struct _bson_json_opts_t bson_json_opts_t;
bson_json_opts_t *
bson_json_opts_new (bson_json_mode_t mode, int32_t max_len);
void
bson_json_opts_destroy (bson_json_opts_t *opts);
```

## DESCRIPTION

The *bson\_json\_opts\_t* structure contains options for encoding BSON into *MongoDB Extended JSON*.

The **mode** member is a *bson\_json\_mode\_t* defining the encoding mode.

The **max\_len** member holds a maximum length for the resulting JSON string. Encoding will stop once the serialised string has reached this length. To encode the full BSON document, **BSON\_MAX\_LEN\_UNLIMITED** can be used.

**SEE ALSO:**

```
bson_as_json_with_opts()
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
