# Issue converting imported json list of dicts from unicode to a list

**URL:** <https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [August 5, 2023, 5:09pm UTC](https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492 "2023-08-05T17:09:32Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 7, 2023, 4:26pm UTC](https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492/21 "2023-08-07T16:26:58Z")

</div>

Well, alright, it is the BOM. :sigh:

We should probably make `system.file.readFilesAsString()` better at that, somehow. In the meantime, something like this should work:

```python
bytes = system.file.readFileAsBytes("/Users/pgriffith/Downloads/Three Parameter Model Data.json")

from org.apache.commons.io.input import BOMInputStream
from java.io import ByteArrayInputStream, ByteArrayOutputStream
from java.lang import String

bomInput = BOMInputStream(ByteArrayInputStream(bytes))
outputStream = ByteArrayOutputStream(len(bytes))
bomInput.transferTo(outputStream)
bytesOut = outputStream.toByteArray()
strOut = String(bytesOut, "utf-8")

print system.util.jsonDecode(strOut)

```

---

<div class="post-metadata">

**Author:** ![Joseph\_Alcide](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@Joseph\_Alcide](https://forum.inductiveautomation.com/u/Joseph_Alcide)\
**Post date:** [August 7, 2023, 4:27pm UTC](https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492/22 "2023-08-07T16:27:02Z")

</div>

Thank you for the help! Appreciate it!

---

<div class="post-metadata">

**Author:** ![Joseph\_Alcide](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@Joseph\_Alcide](https://forum.inductiveautomation.com/u/Joseph_Alcide)\
**Post date:** [August 7, 2023, 4:28pm UTC](https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492/23 "2023-08-07T16:28:00Z")

</div>

I will try this now, thank you!

---

<div class="post-metadata">

**Author:** ![Joseph\_Alcide](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@Joseph\_Alcide](https://forum.inductiveautomation.com/u/Joseph_Alcide)\
**Post date:** [August 7, 2023, 4:45pm UTC](https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492/24 "2023-08-07T16:45:38Z")

</div>

Works thank you so much!

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 7, 2023, 5:08pm UTC](https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492/25 "2023-08-07T17:08:22Z")

</div>

> [@pascal.fragnoud](#):
>
> I have no idea what BOM means.

> **[Byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)**
>
> The byte order mark (BOM) is a particular usage of the special Unicode character, .mw-parser-output .monospaced{font-family:monospace,monospace}U+FEFF ZERO WIDTH NO-BREAK SPACE, whose appearance as a magic number at the start of a text stream can signal several things to a program reading the text:
> BOM use is optional. Its presence interferes with the use of UTF-8 by software that does not expect non-ASCII bytes at the start of a file but that could otherwise handle the text stream.
> Unicode ...

[Previous page](https://forum.inductiveautomation.com/t/issue-converting-imported-json-list-of-dicts-from-unicode-to-a-list/77492.md?page=1)
