# Input a dictionary from dynamo (DesignScript.Builtin.Dictionary) to a custom ZeroTouch node

**URL:** <https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577>\
**Category:** Developers\
**Tags:** zerotouch\
**Created:** [April 19, 2022, 2:37am UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577 "2022-04-19T02:37:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hadi.Moosavi](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@Hadi.Moosavi](https://forum.dynamobim.com/u/Hadi.Moosavi)\
**Post date:** [April 19, 2022, 2:37am UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577/1 "2022-04-19T02:37:45Z")

</div>

Hi Everyone,

I am trying to feed a dictionary that comes out of a python node (type: DesignScript.Builtin.Dictionary) into a zerotouch node that I am developing in C#.

How can I cast or convert this input to a normal C# dictionary that I can then use in my code?

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [April 19, 2022, 3:19am UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577/2 "2022-04-19T03:19:26Z")

</div>

I think you’d need to get the key/value pairs from the DesignScript dictionary and put them in a new `Dictionary<string, object>` in your ZT node.

---

<div class="post-metadata">

**Author:** ![Hadi.Moosavi](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@Hadi.Moosavi](https://forum.dynamobim.com/u/Hadi.Moosavi)\
**Post date:** [April 19, 2022, 3:36am UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577/3 "2022-04-19T03:36:25Z")

</div>

Thank you for the reply.  
But how do I access the pair in my code?  
Using dictionary type as the input type does not work.

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [April 20, 2022, 3:03am UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577/4 "2022-04-20T03:03:51Z")

</div>

you can just reference the Dynamo dictionary type, it’s in the designscriptbuiltin.dll which is part of the dynamocore nuget package.

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [April 20, 2022, 3:08am UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577/5 "2022-04-20T03:08:31Z")

</div>

it also looks like `IDictionary` should be converted automatically, or `Dictionary` for that matter so a code repro case would be useful.

> <https://github.com/DynamoDS/Dynamo/blob/master/src/Engine/ProtoCore/FFI/CLRObjectMarshaler.cs#L452>

---

<div class="post-metadata">

**Author:** ![Hadi.Moosavi](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@Hadi.Moosavi](https://forum.dynamobim.com/u/Hadi.Moosavi)\
**Post date:** [April 20, 2022, 4:28pm UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577/6 "2022-04-20T16:28:25Z")

</div>

I was able to use System.Collections.IDictionary and it worked fine.  
Thank you!

---

<div class="post-metadata">

**Author:** ![Ricardo\_Freitas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ricardo_freitas/32/9559_2.png) [@Ricardo\_Freitas](https://forum.dynamobim.com/u/Ricardo_Freitas)\
**Post date:** [May 8, 2024, 6:34pm UTC](https://forum.dynamobim.com/t/input-a-dictionary-from-dynamo-designscript-builtin-dictionary-to-a-custom-zerotouch-node/75577/7 "2024-05-08T18:34:21Z")

</div>

**I solve that using this methodology.**

1. Your Node Input must be an `IDictionary`.

2. Then, inside in your Node logic you need to convert the IDictionary to a strong typed Dictionary.

This allows you to consume your input data as you wish.

See images below showing how I implement that.

**Node Method**

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/0/80338931e5a078061ce0f743630a4441fd8c57c0.png)

**Generic extension method to convert IDictionary to the strong typed Dictionary**

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/d/0d87dbd6a1f5ffa9f7cc26daae2dc0978850ab33.png)

**Dynamo Graph**

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/f/5f59cad11e70b2e31970f8ceb2dc7e36783883a1.png)
