⬆️ Change encode map json lib

This commit is contained in:
LittleSheep 2024-11-04 00:12:17 +08:00
parent 7e4d6bb33f
commit e1207a8deb
2 changed files with 6 additions and 4 deletions

View File

@ -104,7 +104,7 @@ func main() {
} }
// Post-boot actions // Post-boot actions
directory.ValidateServices() go directory.ValidateServices()
// Server // Server
go server.NewServer().Listen() go server.NewServer().Listen()

View File

@ -1,14 +1,16 @@
package nex package nex
import jsoniter "github.com/json-iterator/go" import (
"github.com/goccy/go-json"
)
func EncodeMap(data any) []byte { func EncodeMap(data any) []byte {
raw, _ := jsoniter.Marshal(data) raw, _ := json.Marshal(data)
return raw return raw
} }
func DecodeMap(raw []byte) map[string]any { func DecodeMap(raw []byte) map[string]any {
var out map[string]any var out map[string]any
_ = jsoniter.Unmarshal(raw, &out) _ = json.Unmarshal(raw, &out)
return out return out
} }