JSON package
- Updated: 2025/02/28
JSON package
The JSON package is useful for working with JSON data. It allows you to effectively manipulate the JSON data, such as adding or updating values within a JSON string, parsing JSON strings into objects using node path, and converting JSON strings to dictionaries and vice versa.
This package plays a crucial role in seamlessly integrating automation workflows with web services and APIs that use JSON for data exchange.
Benefits
- JavaScript Object Notation (JSON) is a lightweight, easy-to-understand, extensible format for storing, transporting, and retrieving data. JSON uses key-value pairs of data and delivers faster data interchange and web service results.
- Most REST Web Services (APIs), some configuration files, and many NoSQL databases such as MongoDB commonly use JSON because of its flexible format for data exchange. It is text-based, lightweight, and has an easy-to-parse data format, which means it requires no additional code to understand and interpret the provided data.
- JSON files can be great for storing and retrieving configuration data your automation might reference when determining server, environment-specific, or folder-share details.
- JSON's flexible structure efficiently accommodates various data types and complex data hierarchies.
JSON data types
The values in JSON must be of following data type:
- Strings
- Numbers
- Object (JSON Object)
- Array
- Booleans
Note: The value NULL is not supported in Automation 360. Therefore, when you extract JSON data and convert it to
a dictionary variable, any null values in the JSON string are not converted, as
dictionary variables do not support null values. However, if the JSON contains an
empty string ("") instead of null, it will be successfully converted to a dictionary
variable.
Understanding JSON structures
In JSON, data is mainly stored in two structures:
- Objects: Objects in JSON are collections of key, value pairs enclosed in curly
braces {}. Each key is a string enclosed with quotes (““) followed by a colon (:)
, and commas (,) are used to separate the key, value pairs.
Example: {"name ": "John", "age": "30", "city": Detroit}
- Arrays: Arrays are ordered lists of values, enclosed in square brackets [].
Values within an array are separated by commas (,).
Example: ["John", "Annie", "Shane"]
Using JSON package
Use the actions in the JSON package in the following
order:
- Start the JSON session using the Start session action. Use this session name for all corresponding actions.
- Use the different actions available in the JSON package to automate JSON related tasks.
- End the session using the End session action to complete a task.
Actions in the JSON package
The JSON package includes the following actions: