# Console runs script that transform doesn't

**URL:** <https://forum.inductiveautomation.com/t/console-runs-script-that-transform-doesnt/59364>\
**Category:** Ignition\
**Tags:** ignition80, scripting, perspective\
**Created:** [May 9, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/console-runs-script-that-transform-doesnt/59364 "2022-05-09T16:05:36Z")\
**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:** [May 9, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/console-runs-script-that-transform-doesnt/59364/2 "2022-05-09T16:33:34Z")

</div>

`deepcopy` doesn't "know" how Perspective's internal objects work; it's a bigger hammer than you need.

Try the code in this post to directly convert to 'native' list and dict objects:

> [@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/console-runs-script-that-transform-doesnt/59364)._
