# Copy Object Details by Value, Not Reference

**URL:** <https://forum.inductiveautomation.com/t/copy-object-details-by-value-not-reference/52501>\
**Category:** Ignition\
**Tags:** perspective, scripting, ignition80\
**Created:** [October 29, 2021, 2:31pm UTC](https://forum.inductiveautomation.com/t/copy-object-details-by-value-not-reference/52501 "2021-10-29T14:31:13Z")\
**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:** [November 1, 2021, 5:40pm UTC](https://forum.inductiveautomation.com/t/copy-object-details-by-value-not-reference/52501/11 "2021-11-01T17:40:41Z")

</div>

You can do a recursive descent function, converting to builtin types each step of the way, like this:

> [@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/copy-object-details-by-value-not-reference/52501)._
