# Scripting function takes a dict however the received datatype is DotReferenceJythonMap

**URL:** <https://forum.inductiveautomation.com/t/scripting-function-takes-a-dict-however-the-received-datatype-is-dotreferencejythonmap/80410>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [October 12, 2023, 7:20pm UTC](https://forum.inductiveautomation.com/t/scripting-function-takes-a-dict-however-the-received-datatype-is-dotreferencejythonmap/80410 "2023-10-12T19:20:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [October 12, 2023, 7:20pm UTC](https://forum.inductiveautomation.com/t/scripting-function-takes-a-dict-however-the-received-datatype-is-dotreferencejythonmap/80410/1 "2023-10-12T19:20:06Z")

</div>

I am using a Perspective onActionPerformed Script to open a popup:

```auto
system.perspective.openPopup('def', 'facility/addTask/confirmation', params = {'new_dict': new_dict}, modal = True)
```

In the gateway logger I have verified that _new\_dict_ being put into the function call is of type:

```auto
new_dict is: <type 'dict'>
```

In the popup I have a parameter called _new\_dict_ and the first thing I do is use a script transform to display the datatype of the parameter. I get the following datatype:

```auto
class com.inductiveautomation.perspective.gateway.script.DotReferenceJythonMap
```

How can I convert this back to a jython dictionary? Or how can I loop through and unpack my dictionary values from a JythonMap?

[https://docs.inductiveautomation.com/display/DOC81/system.perspective.openPopup](https://docs.inductiveautomation.com/display/DOC81/system.perspective.openPopup)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 12, 2023, 7:26pm UTC](https://forum.inductiveautomation.com/t/scripting-function-takes-a-dict-however-the-received-datatype-is-dotreferencejythonmap/80410/2 "2023-10-12T19:26:53Z")

</div>

Try supplying it to the `dict()` constructor. (This works only for single-level mapping objects.)

Perspective converts any jython dictionaries and/or lists (in any nested combination) to Perspective property objects, dropping the pythonic origin. Then when delivered back to jython elsewhere, Perspective places them in a wrapper object that supports attribute referencing.

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [October 12, 2023, 7:27pm UTC](https://forum.inductiveautomation.com/t/scripting-function-takes-a-dict-however-the-received-datatype-is-dotreferencejythonmap/80410/3 "2023-10-12T19:27:43Z")

</div>

The JythonMap behaves the same as a dict for most purposes.

[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.32/com/inductiveautomation/perspective/gateway/script/DotReferenceJythonMap.html](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.32/com/inductiveautomation/perspective/gateway/script/DotReferenceJythonMap.html)

If you look at the reference above, you'll see it supports all the usual methods of a python `dict`, including `keys()`, `items()`, etc.

On closer inspection, there is also a `toDict()` method that presumably will explicitly return the `dict` inside the wrapper. However, you should never really need it in everyday usage.

See also the discussion here:

> [@Test variable type](https://forum.inductiveautomation.com/t/test-variable-type/67326):
>
> Hello, Is it possible to check if a variable is : dict or DotReferenceJythonMap list or JsonifiableArrayList ? Thanks

EDIT: updated javadocs reference to latest version (as of this posting)
