Commit eddf3ec3 authored by Jeromy's avatar Jeromy

merkledag: fix json marshalling of pbnode

License: MIT
Signed-off-by: default avatarJeromy <why@ipfs.io>
parent 9eb1a21c
......@@ -2,6 +2,7 @@ package merkledag
import (
"context"
"encoding/json"
"fmt"
node "gx/ipfs/QmRSU5EqqWVZSNdbU51yXmVoF1uNw3JgTNB6RaiL7DZM16/go-ipld-node"
......@@ -228,6 +229,15 @@ func (n *ProtoNode) Loggable() map[string]interface{} {
}
}
func (n *ProtoNode) MarshalJSON() ([]byte, error) {
out := map[string]interface{}{
"data": n.data,
"links": n.links,
}
return json.Marshal(out)
}
func (n *ProtoNode) Cid() *cid.Cid {
if n.encoded != nil && n.cached != nil {
return n.cached
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment