Skip to content

Failed to umarshal type []byte #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
socket515 opened this issue Jul 21, 2021 · 1 comment · Fixed by #273
Closed

Failed to umarshal type []byte #266

socket515 opened this issue Jul 21, 2021 · 1 comment · Fixed by #273
Labels
bug Something isn't working

Comments

@socket515
Copy link

socket515 commented Jul 21, 2021

go version: go1.16
example:

import (
        "fmt"
        stdjson "encoding/json"
	"github.com/goccy/go-json"
)

type Request struct {
	Name string `json:"name"`
	PayLoad []byte `json:"pay_load"`
}

func main() {
      bs := []byte(`{"name":"hah","pay_load":"LWItFQcIBQwvDA==\n"}`)
      r := new(Request)
      fmt.Println(json.Unmarshal(bs, r)) // return base64 err
      fmt.Println(stdjson.Unmarshal(bs, r)) // nil
}

std json libary can work, go-json return error

@goccy
Copy link
Owner

goccy commented Aug 12, 2021

Thank you for the reporting ! I fixed this issue with #273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants