go get github.com/cyg-pd/go-phpobj@v1This library is v1 and follows SemVer strictly.
No breaking changes will be made to exported APIs before v2.0.0.
This library has no dependencies outside the Go standard library.
You can import go-phpobj using:
import (
"log/slog"
"github.com/cyg-pd/go-phpobj"
)
type PHPJSONData struct {
Data *phpobj.W[struct{ Msg string }]
}
func main() {
m := []byte(`{"Data":{"Msg":"hi"}}`)
var w PHPJSONData
if err := json.Unmarshal(m, &w); err != nil {
panic(err)
}
slog.Info(w.Data.Data().Msg) // hi
}