a!toJson() Function

Function

a!toJson( value, removeNullOrEmptyFields )

Converts a value into a JSON string.

Parameters

Keyword Type Description

value

Any Type

The value to convert into a JSON string.

removeNullOrEmptyFields

Boolean

Determines whether fields with values that are null, empty strings, or empty arrays are removed from the JSON output. Default: false.

Usage considerations

Using the value parameter

The value parameter must be a CDT, a dictionary, a map, a record, or a list.

Using the removeNullOrEmptyField parameter

The removeNullOrEmptyFields parameter removes all fields with values that are null, empty strings, or empty arrays from the generated JSON request body. This is important for certain web services, such as those that follow the OData protocol. Some web services treat fields with null values differently from fields that aren't included in the request body at all. Omitting a field may mean "don't modify the field," while sending a null value for that field would mean "write a null value to the field."

The behavior of removeNullOrEmptyFields can also be leveraged for integrations that send a JSON request body by selecting the checkbox labeled Remove fields with null or empty values from generated JSON.

Old Versions

There are older versions of this function. You can identify older versions by looking at the name to see if there is a version suffix. If you are using an old version, be sure to refer to the corresponding documentation from the list below.

Old Versions Reason for Update
a!toJson_17r1

Improved support for datetime values. This removes the need to create a supporting conversion rule.

To learn more about how Appian handles this kind of versioning, see the Function and Component Versions page.

Open in Github Built: Mon, Sep 27, 2021 (12:29:11 PM)

On This Page

FEEDBACK