# JythonMap item assignment

**URL:** <https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [November 17, 2021, 11:10am UTC](https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175 "2021-11-17T11:10:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [November 17, 2021, 11:10am UTC](https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175/1 "2021-11-17T11:10:24Z")

</div>

Hi,

I have an array of JythonMap in my TimeSeriesChart. I would like to change t\_stamp item to time item.  
Is it possible ?  
One element below :

```auto
{
  "t_stamp": "2021-10-25 00:00:00",
  "converted": "489.406",
  "expected": "702.51",
  "basic": "42.1",
  "a0": "3.6"
}

```

This element after update.

```auto
{
  "time": "2021-10-25 00:00:00",
  "converted": "489.406",
  "expected": "702.51",
  "basic": "42.1",
  "a0": "3.6"
}

```

Mu code below doesn’t work :

```auto
for row in value:
	row['time'] = row['t_stamp']
	del row['t_stamp']

```

Thanks

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 17, 2021, 12:56pm UTC](https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175/2 "2021-11-17T12:56:46Z")

</div>

Code works for me, at least in the Script Console, so I would expect it to work in other places, assuming that value is some type of sequence of maps.

If value is just a map, then this code doesn’t work.

Another option would be to use `pop()` to remove the item, something like:

```auto
for row in value:
    row['time'] = row['t_stamp']
    row.pop('t_stamp')

```

Again, assuming that value is a sequence of maps.

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [November 17, 2021, 1:04pm UTC](https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175/3 "2021-11-17T13:04:14Z")

</div>

```auto
for row in value:
	row['time'] = row['t_stamp']
	row.pop('t_stamp')

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dc90c7c084439f4a861b7edb07607426d603acee.png)

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 17, 2021, 1:47pm UTC](https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175/4 "2021-11-17T13:47:42Z")

</div>

Try changing it to Pydict with .toDict() or Java.util.map with .getRawMap()

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 17, 2021, 1:50pm UTC](https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175/5 "2021-11-17T13:50:32Z")

</div>

You might have to convert to a dict before doing the assignment, or build a new dict from the JythonMap and use this instead:

```python
return [
    {
        'time': item['t_stamp'],
        'converted': item['converted'],
        'expected': item['expected'],
        'basic': item['basic'],
        'a0': item['a0']
    } for item in value
]

```

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [November 17, 2021, 1:57pm UTC](https://forum.inductiveautomation.com/t/jythonmap-item-assignment/53175/6 "2021-11-17T13:57:28Z")

</div>

It works thanks
