jsonSet workaround in script

jsonGet and jsonSet are functions in Ignition’s expression language, they aren’t usable from places where you’re writing scripts in Python.

This case is a little awkward - you’ll have to parse the JSON into a dictionary using jsonDecode, modify the corresponding element (something like foo["documentation"] = "blah", depends on the structure of your UDT), then turn the dictionary back to JSON with jsonEncode, and write that updated JSON back to the tag with system.tag.write.

edit: the Document object in our tag system might be a mutable GSON object and not a String… I’ll have to look at this in a bit when I get the office.

1 Like