Json Set Value
Is a keyword that assigns a new value to a specific information field in a Json object
Platform
Web, iOS, Android, Windows, JavaSwing, Window, API, JDBC, SSH, FTP
Attributes
| Attributes | Data Source | Recommended |
|---|---|---|
| Json: is the json object that is interacted with in the keyword Usually the return result of the keywords Read Json File, Read Json String... | The default system is Variable | Json |
| fieldname: the information field is assigned a value | The default system is Variable | String |
| value: is the value assigned to the keyword | Value: value does not change during testing Variable (commonly used): is a parameter when performing data driven testing Parameter: used when the data passed into the test script changes according to the environment (Environment parameter), device (Device parameter), version (Version parameter), agent (Agent parameter) | String |
Use case
Use when you need to change the value of an information field in a specific Json
Example
Json:
{
"user": [
"tester01",
"tester02"
],
"id": "5606163a-4bc5-454b-8a29-1530ddc8d8be",
"code_integer": 37684,
"code_long": 2.423235879789781e+22,
"code_double": 34854.99774,
"value": {
"name": "host",
"status": "false"
}
}
get field name = id,
value = test_id
Result:
{
"user": [
"tester01",
"tester02"
],
"id": "test_id",
"code_integer": 37684,
"code_long": 2.423235879789781e+22,
"code_double": 34854.99774,
"value": {
"name": "host",
"status": "false"
}
}