-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
-
None
Our bson.D type doesn't support converting to/from JSON via the stdlib json.Marshal and json.Unmarshal functions. This causes issues for users with interface{} in their structs because the driver decodes BSON documents as bson.D when the target type is interface{}. If the user then tries to marshal the struct as JSON, the resulting JSON is an array of documents because bson.D is internally represented as a slice of structs.
Definition of done:
- bson.D implements the json.Marshaler and json.Unmarshaler interfaces and output a key-value representation of the bson.D in "regular" (i.e. non-Extended) JSON.
- is duplicated by
-
GODRIVER-2790 Make "bson.D" implement "json.Marshaler" and "json.Unmarshaler"
- Closed
- related to
-
GODRIVER-2591 Make all BSON types (bson.D, bson.M, bson.Regex, etc) default string representation Extended JSON
- Closed