activities
latest
false
- Overview
- Cryptography
- Database
- Java
- Python
- WebAPI
Developer activities
UiPath.WebAPI.Activities.JSON.SerializeJson
Description
Serializes the given Object to a JSON string, optionally based on the custom serializer settings.
Project compatibility
Windows | Cross-platform
Prerequisites
To configure the Serializer settings property using data mapping, use Studio 25.10 or later. In earlier Studio versions, this property uses the Expression Editor window instead.
Windows, Cross-platform configuration
- Input object - The object to be serialized to a JSON string.
Advanced options
Input
- Serializer settings - Custom serializer settings to be used when serializing the object. Use this property when you want to fully control how the provided object gets serialized.
Output
- JSON object - The serialized JSON string.
Example of using Serializer settings
When no data mapping is available for the Serializer settings property, configure it in the Expression Editor using one of the following code snippets. For more information, see the Newtonsoft documentation.
VB.NET
New JsonSerializationSettings With {
.Formatting = JsonFormatting.Indented,
.NullValueHandling = JsonNullValueHandling.Ignore,
.DefaultValueHandling = JsonDefaultValueHandling.Ignore,
.DateFormatHandling = JsonDateFormatHandling.IsoDateFormat,
.DateFormatString = "yyyy-MM-dd HH"
}
New JsonSerializationSettings With {
.Formatting = JsonFormatting.Indented,
.NullValueHandling = JsonNullValueHandling.Ignore,
.DefaultValueHandling = JsonDefaultValueHandling.Ignore,
.DateFormatHandling = JsonDateFormatHandling.IsoDateFormat,
.DateFormatString = "yyyy-MM-dd HH"
}
C#
new JsonSerializationSettings
{
Formatting = JsonFormatting.Indented,
NullValueHandling = JsonNullValueHandling.Ignore,
DefaultValueHandling = JsonDefaultValueHandling.Ignore,
DateFormatHandling = JsonDateFormatHandling.IsoDateFormat,
DateFormatString = "yyyy-MM-dd HH"
}
new JsonSerializationSettings
{
Formatting = JsonFormatting.Indented,
NullValueHandling = JsonNullValueHandling.Ignore,
DefaultValueHandling = JsonDefaultValueHandling.Ignore,
DateFormatHandling = JsonDateFormatHandling.IsoDateFormat,
DateFormatString = "yyyy-MM-dd HH"
}