Search

User Manual

GETTING STARTED


MODULES AND PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


GLOSSARY


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support
SDK Documentation
SDK Examples

ALL MANUAL VERSIONS

Ignition 8
Ignition 7.9
Ignition 7.8

Deprecated Pages

Skip to end of metadata
Go to start of metadata

This function is used by Ignition's Expression language.

Description

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.

Syntax

 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.
"{key:value}"
 
//You may optionally wrap strings in quotation marks.
"{'key':'value'}" 

//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.

Examples
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