Invoking JSON Marshal/Unmarshal Functions

JSON marshal and unmarshal functions are invoked using the standard Go JSON calling conventions defined in encoding/json. For Marshal the format is:

func Marshal(v interface{}) ([]byte, error)

where v is the value to be encoded. The encode result is returned as a byte slice.

For Unmarshal, the format is:

func Unmarshal(data []byte, v interface{}) error

where data is a byte buffer containing the encoded JSON data to be unmarshaled (decoded) and v is the target variable into which the decoded data will be stored.