github.com/unirita/cuto@v0.9.8-0.20160830082821-aa6652f877b7/show/gen/json.go (about) 1 // Copyright 2015 unirita Inc. 2 // Created 2015/04/10 shanxia 3 4 package gen 5 6 import ( 7 "encoding/json" 8 ) 9 10 // JSON形式のジェネレーター 11 type JsonGenerator struct { 12 } 13 14 func (s JsonGenerator) Generate(out *OutputRoot) (string, error) { 15 byteMessage, err := json.Marshal(out) 16 if err != nil { 17 return "", err 18 } 19 return string(byteMessage), nil 20 }