// MarshalJSON implements the encoding/json Marshaler interface. Before
// returning the encoded value, this function will validate the contained JSON
// and return any parsing errors encountered.
MarshalJSON implements the encoding/json Marshaler interface. Before
returning the encoded value, this function will validate the contained JSON
and return any parsing errors encountered.
// MarshalJSON implements the encoding / json Marshaler interface . Before // returning the encoded value this function will validate the contained JSON // and return any parsing errors encountered .
func (j RawJSON) MarshalJSON() ([]byte, error) {
	if len(j) == 0 {
		return nil, fmt.Errorf("types.RawJSON: invalid JSON, an empty string cannot be unmarshaled")
	}
	var ret RawJSON
	if err := json.Unmarshal(j, &ret); err != nil {
		return nil, err
	}
	return ret, nil
}
func ( j RawJSON ) MarshalJSON ( ) ( [ ] byte , error ) { if len ( j ) == 0 { return nil , fmt . Errorf ( " " ) } var ret RawJSON if err := json . Unmarshal ( j , & ret ) ; err != nil { return nil , err } return ret , nil }
MarshalJSON implements the encoding/json Marshaler interface.
MarshalJSON implements the encoding / json Marshaler interface .
// An empty byte slice is not valid JSON. Return an error that's more // descriptive than the encoding/json message. // Unmarshal to look for errors, unmarshal into a RawJSON to keep // unnecessary allocations to a minimum. // NB. At the time of writing, what I _actually_ want to call is // json.checkValid, but that function is not exported. So.