- 概述
- 加密
- 数据库
- Java
- Python
- 网页 API

开发者活动
UiPath.WebAPI.Activities.DeserializeJson
-
JSON 字符串 - 此为包含要反序列化的 JSON 数组的字符串。应在无缩进的情况下在双引号之间编写 JSON。JSON 中的字符串应使用单引号编写。下例展示了有效的 JSON:“{'TenancyName': 'Documentation', 'UsernameOrEmail': 'Documentation', 'Password': 'Documentation'}”。
- JSON 示例- 输出结构的 JSON 示例。 该活动会将此示例转换为您可以在设计时使用的类似对象。
高级选项
输入
- “输入类型”-此为下拉列表,用于从中选择要反序列化的对象的参数类型。
Note: In Studio Web, parsing the sample object via the JSON Sample property makes the Input Type property read-only.
输出
- JSON object - The deserialized JSON, as a
Newtonsoft.Json.Linq.JObject
variable. Read more information onNewtonsoft.Json.Linq.JObject
objects.
属性面板
常见
- “显示名称”- 活动的显示名称。
输入
-
JSON 示例- 输出结构的 JSON 示例。 该活动会将此示例转换为您可以在设计时使用的类似对象。
- JsonString - The string containing the JSON to be deserialized. Write the JSON without indents, and between double quotes. Strings inside the JSON should be written with single quotes. For example, the following JSON is valid: "{'TenancyName': 'Documentation', 'UsernameOrEmail': 'Documentation', 'Password': 'Documentation'}".
其他
- “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
- “类型参数” - 此为下拉列表,用于从中选择返回的输出类型。 系统会将所提供的 JSON 字符串转换为所选类型的对象。
输出
- JsonObject - The deserialized JSON, as a
Newtonsoft.Json.Linq.JObject
variable. Read more information onNewtonsoft.Json.Linq.JObject
objects.
The Deserialize Json activity is used for extracting data from JSON files and strings.
To exemplify how to use this activity, we have created an example that uses the Deserialize Json activity for extracting the age of a person from a JSON file.
此自动化流程的构建方法如下:
- 打开 Studio ,创建一个新“流程”。
-
将序列活动拖动至“工作流设计器”。
-
创建以下变量:
变量名称
变量类型
默认值
JsonText
字符串
JsonObj
JObject
Age
泛型值
-
-
将读取文本文件活动拖动至序列容器中。
- 在属性面板中,向文件名字段添加值
"JsonString.txt"
。 - 在“内容”字段中添加“
JsonText
”变量。
- 在属性面板中,向文件名字段添加值
-
将“反序列化 JSON”活动添加到“读取文本文件”活动之后。
- 在“ 属性 ” 面板中,在“ JsonString” 字段中添加变量
JsonText
,在“ JsonObject ” 字段中添加变量JsonObj
。 - 从类型参数下拉列表中选择
Newtonsoft.Json.Linq.JObject
值。
- 在“ 属性 ” 面板中,在“ JsonString” 字段中添加变量
-
将“ 分配 ”活动放置在“ 反序列化 JSON ”活动下。
- 在目标字段中添加
Age
变量,并在值字段中添加JsonObj.SelectToken("age").ToString
表达式。
- 在目标字段中添加
-
将“写入行”活动拖动到“分配”活动之后。
- 在“文本”字段中添加“
Age
”变量。
- 在“文本”字段中添加“
- 运行流程。 机器人从
.json
文件中提取年龄值,并将其显示在“ 输出 ”面板中。
您可以在此处 下载示例。