method
Value.MarshalJSON
Encode the value as JSON.
Example
encoded, err := value.MarshalJSON()Returns
The JSON encoding.
([]byte, error)How it works
Output matches encoding/json for the same data: object keys are sorted and strings use HTML-safe escapes. Non-finite numbers and the zero Value return an error.
Full signature
func (value Value) MarshalJSON() (
[]byte,
error,
)Related types
ValueAn immutable scalar, object, list, or populated document value.