# Function to convert json string or python dict into ObjectWrapper

**URL:** <https://forum.inductiveautomation.com/t/function-to-convert-json-string-or-python-dict-into-objectwrapper/32861>\
**Category:** Ignition\
**Created:** [March 5, 2020, 10:45pm UTC](https://forum.inductiveautomation.com/t/function-to-convert-json-string-or-python-dict-into-objectwrapper/32861 "2020-03-05T22:45:39Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 5, 2021, 4:34pm UTC](https://forum.inductiveautomation.com/t/function-to-convert-json-string-or-python-dict-into-objectwrapper/32861/11 "2021-05-05T16:34:05Z")

</div>

Ah, so it is an ObjectWrapper...  
Interesting. I'm actually not sure whether we can 'fix' that; it'd be nice if `dict` was automatically recursive, but c'est la vie. We'd have to introduce a new method, which sounds pretty gross...

You could make your deep to-dict function not care about specific types by relying on the presence of Python magic methods, as in this post:

> [@\[IGN-5231\] jsonEncode issue](http://forum.inductiveautomation.com/t/jsonencode-issue/44603/26):
>
> 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: 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(): …

---

_[View the full topic](https://forum.inductiveautomation.com/t/function-to-convert-json-string-or-python-dict-into-objectwrapper/32861)._
