Skip to end of metadata
Go to start of metadata

The following feature is new in Ignition version 7.9.2
Click here to check out the other new features
This function is used by Ignition's Expression language.


Takes a JSON friendly string, a path string, and value, and will return a new JSON friendly string with the provided path set to the provided value. This is best used in conjunction with the Derived Tags writeback value.


 jsonSet(json, path, value)

  • Parameters

string json - The JSON string. The string must be in a JSON friendly format.

//The json parameter must be wrapped in {}, and contain a colon between the key and the value.
//Since the parameter passed is a string datatype, the whole parameter must be wrapped in quotes.
//You may optionally wrap strings in quotation marks.

//You may also nest objects inside of the value, much like you can do with Python dictionaries.
"{keyCollection1:{firstKey:value1, secondKey:value2}, keyCollection2:{firstKey:value1, secondKey:value2}}"

string path - The path string.

object value - The replacement for the value at the path.

  • Results

string - A JSON friendly string with a new value set at the specified path.

Code Snippet
// This example takes a JSON friendly string and sets the provided path to the given value. This would then return the string {'item':{'firstThing':1, 'secondThing':5}}

jsonSet("{'item':{'firstThing':1, 'secondThing':2}}", "item.secondThing", 5)
  • No labels