From d9d527a65dd068e0a093ed94ad5effc13567a5e1 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 25 Dec 2014 05:59:42 -0800 Subject: table: make table json prettier Even 'jq' command makes the output very nicer. $ curl http://localhost:8080/v1/bgp/neighbor/10.0.0.1/local-rib |jq '.' Signed-off-by: FUJITA Tomonori --- table/path.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'table/path.go') diff --git a/table/path.go b/table/path.go index 9b38bc44..635cbf5d 100644 --- a/table/path.go +++ b/table/path.go @@ -97,7 +97,6 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) { aslist = append(aslist, path.AS...) } } - asPath, _ := json.Marshal(aslist) var prefix net.IP var prefixLen uint8 @@ -110,7 +109,7 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Network string Nexthop string - AsPath string + AsPath []uint32 Metric string //origin string Best string @@ -118,7 +117,7 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) { Network: prefix.String() + "/" + fmt.Sprint(prefixLen), Nexthop: pd.nexthop.String(), Metric: fmt.Sprint(med), - AsPath: string(asPath), + AsPath: aslist, Best: fmt.Sprint(pd.isBest), }) } -- cgit v1.2.3