# DAML array of decimal in python?

**URL:** <https://forum.canton.network/t/daml-array-of-decimal-in-python/775>\
**Category:** App Development\
**Created:** [July 1, 2020, 4:47pm UTC](https://forum.canton.network/t/daml-array-of-decimal-in-python/775 "2020-07-01T16:47:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ManishGrover](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/manishgrover/32/63_2.png) [@ManishGrover](https://forum.canton.network/u/ManishGrover)\
**Post date:** [July 1, 2020, 4:47pm UTC](https://forum.canton.network/t/daml-array-of-decimal-in-python/775/1 "2020-07-01T16:47:14Z")

</div>

Hi,

I have a field defined in my DAML template as

values: [Decimal]

In my python integration it is being received as `[Decimal('200.0000000000'), Decimal( '186.0000000000'), Decimal('150.0000000000')]`.

The integration looks for this contract, picks it up and then tries to convert this into Json.

`data = ["readings" = request["values"] ]`

The decimal array received this way doesn’t work - Object of type Decimal is not JSON serializable

How do I get this as `[200.0000000000, 186.0000000000, 150.0000000000]`

Appreciate your help.

Regards,  
Manish

---

<div class="post-metadata">

**Author:** ![anthony](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/anthony/32/419_2.png) [@anthony](https://forum.canton.network/u/anthony)\
**Post date:** [July 1, 2020, 4:59pm UTC](https://forum.canton.network/t/daml-array-of-decimal-in-python/775/2 "2020-07-01T16:59:04Z")

</div>

I believe you can pass them over JSON as strings.

[https://docs.daml.com/json-api/lf-value-specification.html#decimal](https://docs.daml.com/json-api/lf-value-specification.html#decimal)

---

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [July 1, 2020, 7:22pm UTC](https://forum.canton.network/t/daml-array-of-decimal-in-python/775/3 "2020-07-01T19:22:27Z")

</div>

How are you building your Python integration? Which API are you calling, using which tooling? If you want JSON, I’d recommend using the JSON API.

---

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [July 1, 2020, 7:59pm UTC](https://forum.canton.network/t/daml-array-of-decimal-in-python/775/4 "2020-07-01T19:59:56Z")

</div>

@ManishGrover is [DAZL](https://github.com/digital-asset/dazl-client/blob/1f0499ab0f37b528396adb86d8ab030be17d4d24/python/docs/basics.rst#basics) being too convenient for you?

Never fear, Python’s `str` to the rescue:

```haskell
>>> str(Decimal('200.0000000000'))
'200.0000000000'

```

---

<div class="post-metadata">

**Author:** ![ManishGrover](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/manishgrover/32/63_2.png) [@ManishGrover](https://forum.canton.network/u/ManishGrover)\
**Post date:** [July 1, 2020, 9:46pm UTC](https://forum.canton.network/t/daml-array-of-decimal-in-python/775/5 "2020-07-01T21:46:58Z")

</div>

thank you.

Used like this:

```haskell
data = 
[ 
"readings" = [str(d) for d in request["values"] ] 
]
```
