User Manual

GETTING STARTED


OTHER EDITIONS


LAUNCHERS


MODULES


PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support

ALL USER MANUAL VERSIONS

Ignition 8.1. Offline Version (04/2021)
Ignition 8 Online Version
Ignition 7.9 Online Version
Ignition 7.8 Online Version

Deprecated Pages

SDK Documentation

Employees

Sign In

Skip to end of metadata
Go to start of metadata

This function is used in Python Scripting.

Description

Takes a JSON string and converts it into a Python object such as a list or a dictionary. If the input is not valid JSON, a string is returned.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.util.jsonDecode(jsonString)

  • Parameters

String jsonString - The JSON string to decode into a Python object.

  • Returns

Any The decoded Python object. See the table below for a listing of how JSON objects are mapped to Python objects. 

  • Scope

Gateway, Vision Client, Perspective Session

JSON to Python Mapping

The table below lists possible JSON types, and the Python types this function maps to. 

JSON TypeMapped Python Type
Boolean (true/false)Boolean (True/False)
StringString
NumericNumber (Float, Integer)
nullNone
ArrayList
ObjectDictionary
Code Examples
# The following example reads in a JSON string, and converts the string to a Python object. 
# The example attempts to read the JSON string from a text file, but this could easily be modified to read data from a web server.
 
# Read the JSON string.
jsonString = system.file.readFileAsString("C:\\tmp\\json.txt")
 
# Decode the JSON string and store the results into a variable.
obj = system.util.jsonDecode(jsonString)
 
# Do something with the results. The code below prints the data type of the results to the console.
print type(obj)
Keywords

system util jsonDecode, util.jsonDecode