# Passing bytearray from scripting to params breaks the format

**URL:** <https://forum.inductiveautomation.com/t/passing-bytearray-from-scripting-to-params-breaks-the-format/95964>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 13, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/passing-bytearray-from-scripting-to-params-breaks-the-format/95964 "2024-09-13T15:22:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmadariaga](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmadariaga/32/63201_2.png) [@mmadariaga](https://forum.inductiveautomation.com/u/mmadariaga)\
**Post date:** [September 13, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/passing-bytearray-from-scripting-to-params-breaks-the-format/95964/1 "2024-09-13T15:22:55Z")

</div>

When passing this pyArray:

`textUEsDBBQABgAIAAAAIQB0DaKhFwIAANkLAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAAC AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...`

to a pop up, I'm getting this:

`<ArrayWrapper>: [80L, 75L, 3L, 4L, 20L, 0L, 6L, 0L, 8L, 0L, 0L, 0L, 33L, 0L, 116L, 13L, -94L, -95L, 23L, 2L, 0L, 0L, -39L, 11L, 0L, 0L, 19L, 0L, 8L, 2L, 91L, 67L, 111L, 110L, 116L, 101L, 110L, 116L, 95L, 8...`

I tried to transform it:

```python
	byte_array = bytearray((b & 0xFF) for b in rawData)
	rawData = base64.b64encode(byte_array).decode('ascii')

```

And it kinda works, but doesnt return the same thing. It makes it a pyUnicode, and when trying to insert it with an sql query it gives an error:

`UEsDBBQABgAIAAAAIQB0DaKhFwIAANkLAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAA (type_ class org.python.core.PyUnicode`

I want to either pass the data without transforming it or be able to get it back to its initial format.

---

<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:** [September 13, 2024, 3:31pm UTC](https://forum.inductiveautomation.com/t/passing-bytearray-from-scripting-to-params-breaks-the-format/95964/2 "2024-09-13T15:31:33Z")

</div>

Assigning anything to a Perspective property (session or component) turns anything not directly supported by JSON into a JSONified substitute. Completely breaking anything like byte arrays or other complex jython objects.

My free [Integration Toolkit module](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934/78) offers `sessionVarMap()`, `pageVarMap()` and `viewVarMap()` as an alternate storage location for jython objects that won't destroy their original form.

(There are alternatives using `system.util.getGlobals()`, but there be dragons.)
