瀏覽代碼

Added Object.UnmarshalJSON

Dmitry Panov 3 年之前
父節點
當前提交
09250e0eba
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      value.go

+ 7 - 0
value.go

@@ -935,6 +935,13 @@ func (o *Object) MarshalJSON() ([]byte, error) {
 	return ctx.buf.Bytes(), nil
 	return ctx.buf.Bytes(), nil
 }
 }
 
 
+// UnmarshalJSON implements the json.Unmarshaler interface. It is added to compliment MarshalJSON, because
+// some alternative JSON encoders refuse to use MarshalJSON unless UnmarshalJSON is also present.
+// It is a no-op and always returns nil.
+func (o *Object) UnmarshalJSON([]byte) error {
+	return nil
+}
+
 // ClassName returns the class name
 // ClassName returns the class name
 func (o *Object) ClassName() string {
 func (o *Object) ClassName() string {
 	return o.self.className()
 	return o.self.className()