diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-25 05:59:42 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-25 05:59:42 -0800 |
commit | d9d527a65dd068e0a093ed94ad5effc13567a5e1 (patch) | |
tree | 389a48290c084887a85e43918971ebdfff2bc5f8 /table/table.go | |
parent | 40819efb0c592d8a23da8bec0006014b43321ac4 (diff) |
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 <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table.go')
-rw-r--r-- | table/table.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/table/table.go b/table/table.go index df55947b..a9d742aa 100644 --- a/table/table.go +++ b/table/table.go @@ -55,12 +55,11 @@ func (td *TableDefault) MarshalJSON() ([]byte, error) { for _, dest := range td.destinations { destList = append(destList, dest) } - j, _ := json.Marshal(destList) return json.Marshal(struct { - Destinations string + Destinations []Destination }{ - Destinations: string(j), + Destinations: destList, }) } |