Problem with SESSIOM CUSTOM and "Invalid Key"

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.

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.


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

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.

1 Like

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


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.