Skip to content
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

invalid character '+' looking for beginning of value occurred when marshalling easyjson struct with encoding/json.Marshal #354

Open
joseph-shi-vungle opened this issue Nov 7, 2021 · 0 comments

Comments

@joseph-shi-vungle
Copy link

In our project, we almost use encoding/json.Marshal/Unmarshal to operate easyjson struct, sometime the following issue always happens when we marshal easyjson struct of message.NotificationMessage with json.Marshal:
json: error calling MarshalJSON for type message.NotificationMessage: invalid character '+' looking for beginning of value

It looks like decoding json error occurred from MarshalJSON function which is generated by easyjson, but it is weird since there is no any code to decode json inside original message.NotificationMessage struct. We doubt it is easyjson issue when we operate them as Marshaler interface by encoding/json, how about your idea about it.

BTW which way is the most recommendation for using easyjson?

  1. Directly using easyjson struct's MarshalJSON/UnmarshalJSON which are generated by easyjson.
  2. Using easyjson.Marshal/Unmarshal to operate easyjson struct as what are demonstrated in README.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant