JSON Marshal fatal error in a unintended loop situation

I was developing an application with an struct that had in it information about is parent and childs with references.
I was not understanding what was wrong with my application until I started making one to open a ticket of error here and forgot to load the parent of the child blocks. After loading the crash was shown.
This being solvable is another question, but as of now I’d suggest the json package to return an error when this situation happens, if possible.

https://play.golang.org/p/sJ2rki6zm7J

2 Likes

Detecting this is tricky. The JSON marshaller is documented to not do that.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.