瀏覽代碼

Support JSON marshalling of PrefixedRegistry.

Alec Thomas 9 年之前
父節點
當前提交
78329dab49
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      json.go

+ 4 - 0
json.go

@@ -81,3 +81,7 @@ func WriteJSON(r Registry, d time.Duration, w io.Writer) {
 func WriteJSONOnce(r Registry, w io.Writer) {
 	json.NewEncoder(w).Encode(r)
 }
+
+func (p *PrefixedRegistry) MarshalJSON() ([]byte, error) {
+	return json.Marshal(p.underlying)
+}