Create universal json decode util
This commit is contained in:
parent
7b9dfe0cee
commit
75e96b9851
@ -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
|
||||
}
|
||||
|
9
jsonUtils/jsonUtils.go
Normal file
9
jsonUtils/jsonUtils.go
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user