# Perspective Scripting: Data Type Issue

**URL:** <https://forum.inductiveautomation.com/t/perspective-scripting-data-type-issue/108841>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [July 23, 2025, 4:25pm UTC](https://forum.inductiveautomation.com/t/perspective-scripting-data-type-issue/108841 "2025-07-23T16:25:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [July 23, 2025, 4:28pm UTC](https://forum.inductiveautomation.com/t/perspective-scripting-data-type-issue/108841/2 "2025-07-23T16:28:11Z")

</div>

BQuacken, you gotta embrace [duck typing](https://en.wikipedia.org/wiki/Duck_typing) 😃

> [@Function to convert json string or python dict into ObjectWrapper](https://forum.inductiveautomation.com/t/function-to-convert-json-string-or-python-dict-into-objectwrapper/32861/16):
>
> Forcing each to the expected type while traversing makes a deep copy: def sanitize\_tree(element): if hasattr(element, '\_\_iter\_\_'): if hasattr(element, 'keys'): return dict((k, sanitize\_tree(element[k])) for k in element.keys()) else: return list(sanitize\_tree(x) for x in element) return element EDIT: Got rid of the unnecessary zip() and used only one keys() iterator instead of two.

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-scripting-data-type-issue/108841)._
