# \[IGN-5231\] jsonEncode issue

**URL:** <https://forum.inductiveautomation.com/t/ign-5231-jsonencode-issue/44603>\
**Category:** Ignition\
**Created:** [March 17, 2021, 10:04pm UTC](https://forum.inductiveautomation.com/t/ign-5231-jsonencode-issue/44603 "2021-03-17T22:04:34Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [April 5, 2021, 3:48pm UTC](https://forum.inductiveautomation.com/t/ign-5231-jsonencode-issue/44603/26 "2021-04-05T15:48:26Z")

</div>

In case others end up fighting this later and are having trouble finding the bad sub-elements of a bigger structure, this is a quick bit of debug code I put together to show the data types of a structure before passing it into `jsonEncode`:

```python
def type_tree(element, prefix='/'):
    type_string = str(type(element))
    output_string = '{}={}\n'.format(prefix, type_string)
    if hasattr(element, ' __iter__'):
        if hasattr(element, 'keys'):
            for key in element.keys():
                output_string = output_string + type_tree(element[key], '{}[{}]'.format(prefix, key))
        else:
            for x, val in enumerate(element):
                output_string = output_string + type_tree(val, '{}[{}]'.format(prefix, x))
    return output_string

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/ign-5231-jsonencode-issue/44603)._
