You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I expected: convert an Envelope object into Json
What I got: a stack overflow when envelope contains at least one part
Release or branch I am using: master
Please find attached a file to reproduce. As I understand the problem, there is an infinite loop while walking the Envelope object as we can go to Envelope.Root.FirstChild.Parent.FirstChild.Parent en so one.
Would it be possible to create a func (e *Envelope) ToJson() (string, error) function ?
Or instruct Json.Marshal to not walk thru the Parent property ?
How do you envision this working @jhillyerd implementing the encoding/json MarshallJSON interface, or having it as a method function as suggested above?
Also what format do we want? Started putting this together as a jumping off point:
There would be a lot of duplicated information if were to encode both the envelope, and the entire part tree to JSON. I suspect most users would just want the envelope content.
Implementing the MarshallJSON interface would be the path of least surprise, and should let Envelope be embedded into other structs for serialization. Given that, I'd like to match the default attribute naming of Go as much as possible, even though I don't love the way Go does it. :)
What I did: json.Marshal(envelope)
What I expected: convert an Envelope object into Json
What I got: a stack overflow when envelope contains at least one part
Release or branch I am using: master
Please find attached a file to reproduce. As I understand the problem, there is an infinite loop while walking the Envelope object as we can go to Envelope.Root.FirstChild.Parent.FirstChild.Parent en so one.
Would it be possible to create a func (e *Envelope) ToJson() (string, error) function ?
Or instruct Json.Marshal to not walk thru the Parent property ?
Thanks for your help
enmime_json_marshal.go.txt
The text was updated successfully, but these errors were encountered: