# JSON Marshal fatal error in a unintended loop situation

**URL:** <https://forum.golangbridge.org/t/json-marshal-fatal-error-in-a-unintended-loop-situation/15008>\
**Category:** Technical Discussion\
**Created:** [August 20, 2019, 12:40am UTC](https://forum.golangbridge.org/t/json-marshal-fatal-error-in-a-unintended-loop-situation/15008 "2019-08-20T00:40:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThigaZ](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/thigaz/32/6035_2.png) [@ThigaZ](https://forum.golangbridge.org/u/ThigaZ)\
**Post date:** [August 20, 2019, 12:40am UTC](https://forum.golangbridge.org/t/json-marshal-fatal-error-in-a-unintended-loop-situation/15008/1 "2019-08-20T00:40:49Z")

</div>

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](https://play.golang.org/p/sJ2rki6zm7J)

---

<div class="post-metadata">

**Author:** ![calmh](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/calmh/32/2896_2.png) [@calmh](https://forum.golangbridge.org/u/calmh)\
**Post date:** [August 21, 2019, 12:10pm UTC](https://forum.golangbridge.org/t/json-marshal-fatal-error-in-a-unintended-loop-situation/15008/2 "2019-08-21T12:10:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.golangbridge.org/uploads/default/original/2X/5/5ad234f7c3dbc68b6cc72d338ce4f2973d9fd81c.png) [@system](https://forum.golangbridge.org/u/system)\
**Post date:** [November 19, 2019, 12:10pm UTC](https://forum.golangbridge.org/t/json-marshal-fatal-error-in-a-unintended-loop-situation/15008/3 "2019-11-19T12:10:34Z")

</div>

Closed on November 19, 2019, 12:10pm UTC

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