Nexus/pkg/nex/encode.go

17 lines
245 B
Go
Raw Permalink Normal View History

2024-10-19 14:36:33 +00:00
package nex
2024-11-03 16:12:17 +00:00
import (
"github.com/goccy/go-json"
)
2024-10-19 14:36:33 +00:00
2024-10-20 16:05:40 +00:00
func EncodeMap(data any) []byte {
2024-11-03 16:12:17 +00:00
raw, _ := json.Marshal(data)
2024-10-19 14:36:33 +00:00
return raw
}
func DecodeMap(raw []byte) map[string]any {
var out map[string]any
2024-11-03 16:12:17 +00:00
_ = json.Unmarshal(raw, &out)
2024-10-19 14:36:33 +00:00
return out
}