package modelarts

import "encoding/json"

func NewInterface(v interface{}) *InterfaceType {
	s, err := json.Marshal(v)
	if err != nil {
		return &InterfaceType{
			Data: string([]byte("")),
		}
	}
	return &InterfaceType{
		Data: string(s),
	}
}

func (x *InterfaceType) MarshalJSON() ([]byte, error) {
	return []byte(x.Data), nil
}

func (x *InterfaceType) UnmarshalJSON(v []byte) error {
	x.Data = string(v)
	return nil
}
