Make Entity implement json.Marshaler & json.Unmarshaler
@@ -43,6 +43,16 @@ func (e *Entity) SetExtendedAttributes(b []byte) {
e.ExtendedAttributes = b
}
+// UnmarshalJSON implements the json.Unmarshaler interface.
+func (e *Entity) UnmarshalJSON(b []byte) error {
+ return dynamic.Unmarshal(b, e)
+}
+
+// MarshalJSON implements the json.Marshaler interface.
+func (e *Entity) MarshalJSON() ([]byte, error) {
+ return dynamic.Marshal(e)
+}
+
// FixtureEntity returns a testing fixture for an Entity object.
func FixtureEntity(id string) *Entity {
return &Entity{
