# Problem with SESSIOM CUSTOM and "Invalid Key"

**URL:** <https://forum.inductiveautomation.com/t/problem-with-sessiom-custom-and-invalid-key/84256>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 14, 2024, 5:15pm UTC](https://forum.inductiveautomation.com/t/problem-with-sessiom-custom-and-invalid-key/84256 "2024-01-14T17:15:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoseJardelLuciano](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@JoseJardelLuciano](https://forum.inductiveautomation.com/u/JoseJardelLuciano)\
**Post date:** [January 14, 2024, 5:15pm UTC](https://forum.inductiveautomation.com/t/problem-with-sessiom-custom-and-invalid-key/84256/1 "2024-01-14T17:15:33Z")

</div>

I have a CUSTOM SESSION that receives data from a function using a Scripting/Project Library.

The script goes through some folders with tags, checking the values and printing them in a dataset.  
 ![02](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/a/6acbe4c732e428f6f1eaf5dcfee0a272ae1eff1f.png)

I use the following Expression to execute.

`runScript('project.charts.data_tables.tags', 30000)`

The script is correctly returning the datasets, as can be seen in the image, however, in the CUSTOM SESSION, "Invalid Key" appears in all returned datasets.

![01](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/2/a2efd887b7f82d31844ec8ac0d8f3147f051512c.png)

---

<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:** [January 14, 2024, 6:34pm UTC](https://forum.inductiveautomation.com/t/problem-with-sessiom-custom-and-invalid-key/84256/2 "2024-01-14T18:34:16Z")

</div>

> [@JoseJardelLuciano](#):
>
> as can be seen in the image

Well, no, we can't see. You haven't shown any data.

> [@JoseJardelLuciano](#):
>
> Invalid Key

That means you are generating an object for Perspective that has keys that are not valid JSON identifiers (have spaces or punctuation, or start with a digit). That is common when blindly converting datasets to JSON format, as datasets allow pretty much anything as column names (matching SQL standards). JSON is more strict.

---

<div class="post-metadata">

**Author:** ![JoseJardelLuciano](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@JoseJardelLuciano](https://forum.inductiveautomation.com/u/JoseJardelLuciano)\
**Post date:** [January 14, 2024, 7:38pm UTC](https://forum.inductiveautomation.com/t/problem-with-sessiom-custom-and-invalid-key/84256/3 "2024-01-14T19:38:00Z")

</div>

> [@pturmel](#):
>
> That means you are generating an object for Perspective that has keys that are not valid JSON identifiers (have spaces or punctuation, or start with a digit). That is common when blindly converting datasets to JSON format, as datasets allow pretty much anything as column names (matching SQL standards). JSON is more strict.

That's really it, the returned dataset contains space in some data, and some columns with null values.

![03](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/9/b9cd8ed9e71d2ae11586c3182dddbe425fcc95bf.png)

---

<div class="post-metadata">

**Author:** ![JoseJardelLuciano](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@JoseJardelLuciano](https://forum.inductiveautomation.com/u/JoseJardelLuciano)\
**Post date:** [January 14, 2024, 8:50pm UTC](https://forum.inductiveautomation.com/t/problem-with-sessiom-custom-and-invalid-key/84256/4 "2024-01-14T20:50:42Z")

</div>

I copied the value generated in these datasets, copied the json and pasted it into a json validator and it appears to be valid.

This is the first time I've worked with dataset and session custom in ignition, and it's been an interesting learning experience.
