You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default behavior when JSON marshalling a bson.Raw field doesn't print the data represented by the bson.Raw field cleanly. Can a MarshalJSON method be added to bson.Raw which would allow the JSON marshaller to cleanly print a value in bson.Raw?
Current:
{
"Kind": 4,
"Data": "{something}"
}
Suggested:
{
"field": "value"
},
Example MarshalJSON:
// MarshalJSON serializes raw bson into JSONfunc (rawRaw) MarshalJSON() ([]byte, error) {
varrawInterfaceinterface{}
err:=raw.Unmarshal(&rawInterface)
iferr!=nil {
returnnil, errors.New("unable to unmarshal BSON data into interface")
}
returnjson.Marshal(rawInterface)
}
The text was updated successfully, but these errors were encountered:
The default behavior when JSON marshalling a
bson.Raw
field doesn't print the data represented by thebson.Raw
field cleanly. Can aMarshalJSON
method be added tobson.Raw
which would allow the JSON marshaller to cleanly print a value in bson.Raw?Current:
Suggested:
Example MarshalJSON:
The text was updated successfully, but these errors were encountered: