From 75e96b9851456e43920682de6ab1557888dbc124 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Wed, 2 Nov 2022 02:42:40 +0300 Subject: [PATCH] Create universal json decode util --- gameUtils/gameUtils.go | 10 ---------- jsonUtils/jsonUtils.go | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 jsonUtils/jsonUtils.go diff --git a/gameUtils/gameUtils.go b/gameUtils/gameUtils.go index 0be80be..8258b26 100644 --- a/gameUtils/gameUtils.go +++ b/gameUtils/gameUtils.go @@ -1,9 +1,5 @@ package gameUtils -import ( - "encoding/json" -) - func FindGameByID(id string, list Games) SteamGame { for _, game := range list.SteamGames { if game.GameId == id { @@ -33,9 +29,3 @@ func GetJSGameInterface(game SteamGame) JSGameInterface { } return newInterface } - -func ConvertServerGamesToJSON(g Games) []byte { - g_json, err := json.Marshal(g) - _ = err //TODO: Check Errors - return g_json -} diff --git a/jsonUtils/jsonUtils.go b/jsonUtils/jsonUtils.go new file mode 100644 index 0000000..c0387cb --- /dev/null +++ b/jsonUtils/jsonUtils.go @@ -0,0 +1,9 @@ +package jsonutils + +import "encoding/json" + +func ConvertToJSON(g interface{}) []byte { + g_json, err := json.Marshal(g) + _ = err //TODO: Check Errors + return g_json +}