--- title: "system.util.jsonEncode" description: "Takes a Python object such as a list or dictionary and converts into a JSON string." --- # system.util.jsonEncode > Takes a Python object such as a list or dictionary and converts into a JSON string. This function is used in **Python Scripting**. ## Description ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.util.jsonEncode(pyObj, [indentFactor])` ### Parameters Type | Parameter | Description ------- | ------- | ------ Any| `pyObj` | The Python object to encode into JSON such as a Python list or dictionary. Integer| `indentFactor` | The number of spaces to add to each level of indentation for prettyprinting. [optional] ### Returns **String** - The encoded JSON string. ### Scope Gateway, Vision Client, Perspective Session ## JSON to Python Mapping The table below lists possible Python types, and how they map to JSON objects. |JSON Type|Mapped Python Type| |--|--| |Boolean (true/false)|Boolean (True/False)| |String|String| |Numeric|Number (Float, Integer)| |null|None| |Array|Sequence| |Object|Dictionary| | Float | BigDecimal (Java) | ## Code Examples ```python title="Example #1" # The following example builds a Python dictionary, and converts it to a JSON string # Build the Python dictionary employeeDict = {"employees":[{"firstName":"John", "lastName":"Doe"},{"firstName":"Anna", "lastName":"Smith"},{"firstName":"Peter", "lastName":"Jones"}]} # Convert the dictionary and store the resulting JSON string in a variable. jsonString = system.util.jsonEncode(employeeDict) ```