View definition

func UnmarshalJSONEnum

Defined in


UnmarshalJSONEnum is a helper function to simplify recovering enum int values from their JSON-encoded representation. Given a map from the enum's symbolic names to its int values, and a byte buffer containing the JSON-encoded value, it returns an int32 that can be cast to the enum type by the caller.

The function can deal with both JSON representations, numeric and symbolic.