# Print to screen?

**URL:** <https://forum.inductiveautomation.com/t/print-to-screen/56418>\
**Category:** Ignition\
**Created:** [February 22, 2022, 6:38pm UTC](https://forum.inductiveautomation.com/t/print-to-screen/56418 "2022-02-22T18:38:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom.roberts](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tom.roberts](https://forum.inductiveautomation.com/u/Tom.roberts)\
**Post date:** [February 22, 2022, 6:38pm UTC](https://forum.inductiveautomation.com/t/print-to-screen/56418/1 "2022-02-22T18:38:45Z")

</div>

Hello - I have a JSON query that is returning a bunch of data to a string called alljson. All I want to do is output this to the screen. In the script console I can just use print alljson it spits everything out perfectly.

I want to do this in a perspective tag event script. I know I could write the output to a file, then display the file but wondering if there is a simpler way to do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [February 22, 2022, 9:22pm UTC](https://forum.inductiveautomation.com/t/print-to-screen/56418/2 "2022-02-22T21:22:29Z")

</div>

I would create a memory tag with the document datatype and write your JSON data to it from the script that puts the JSON data together. You could then just bind your preferred text component in any view directly to the tag’s value to display it.

Just a note on working with document tag types: You will need to use the system.util.jsonDecode() (I _think_; but I may have that backwards and Encode might be the one you want) to convert your JSON data to a format that the document tag type will accept. If your JSON data contains any complex data types (e.g. arrays or objects) or is particularly large, this function will fail. The workaround I have found to work most reliably is doing something like the following:

```auto
from com.inductiveautomation.ignition.common import TypeUtilities

tagPath = '[default]Document_Tag'
value = unicode(TypeUtilities.pyToGson(jsonData))
system.tag.writeAsync([tagPath],[value])

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 22, 2022, 9:45pm UTC](https://forum.inductiveautomation.com/t/print-to-screen/56418/3 "2022-02-22T21:45:32Z")

</div>

It’s not clear what the data structure is and how you want it displayed but a single-row table might suit you. Try this:

1. Drop a Table component onto your view.
2. You need to assign your JSON data to the table’s `props.data`. This could be done most easily by
  - Creating a Named Query to retrieve your data.
  - Add a binding to your table’s `props.data`.
  - Set the Binding Type to `Query`.
  - Select the previously created query from the Query dropdown.
  - Edit the table properties to get it looking just right.

3. Alternately you can get your script to write to the table’s `props.data`.

---

<div class="post-metadata">

**Author:** ![Tom.roberts](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tom.roberts](https://forum.inductiveautomation.com/u/Tom.roberts)\
**Post date:** [February 23, 2022, 4:58pm UTC](https://forum.inductiveautomation.com/t/print-to-screen/56418/4 "2022-02-23T16:58:46Z")

</div>

Thanks to all for the suggestions. I ended up using Transistor’s suggestion and writing to a table.
