diff --git a/controller/controller.go b/controller/controller.go index 5aa0b04..096b1a4 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -6,7 +6,6 @@ import ( "fmt" "log" "reflect" - "strings" jellyapi "github.com/sj14/jellyfin-go/api" ) @@ -27,16 +26,13 @@ func pointer[T any](v T) *T { return &v } -func printStruct(v any) { - j, err := json.MarshalIndent(v, "", "") +func printAsJSON(v any) { + j, err := json.MarshalIndent(v, "", " ") if err != nil { log.Fatalln(err) } - output := strings.ReplaceAll(string(j), "\"", "") - output = strings.Trim(output, "{}") - output = strings.TrimSpace(output) - fmt.Println(output) + fmt.Println(string(j)) } // Set all fields which are nil to the zero value. diff --git a/controller/system.go b/controller/system.go index 06c76a1..deb5bff 100644 --- a/controller/system.go +++ b/controller/system.go @@ -6,7 +6,7 @@ func (c *Controller) GetSystemInfo() error { return err } - printStruct(result) + printAsJSON(result) return err } @@ -16,7 +16,7 @@ func (c *Controller) GetPublicSystemInfo() error { return err } - printStruct(result) + printAsJSON(result) return err }