Value Mapper

This article explains how you can make changes to the value of your data.

 

Value mapper is used to make changes to the value of your data.

Initial data:

{
"id": 8,
"name": "Nicholas Runolfsdottir V",
"username": "Maxime_Nienow",
"email": "Sherwood@rosamond.me",
"address": {
"street": "Ellsworth Summit",
"suite": "Suite 729",
"city": "Aliyaview",
"zipcode": "45169",
"geo": {
"lat": "-14.3990",
"lng": "-120.7677"
}
},
"phone": "586.493.6943 x140",
"website": "jacynthe.com",
"company": {
"name": "Abernathy Group",
"catchPhrase": "Implemented secondary concept",
"bs": "e-enable extensible e-tailers"
}
}

 

The goal: We want to change the value of the company.name from “Abernathy Group” to “Foobar”

 

For this, create a new transformer:

Settings: Data, transform data using mappers and conditions

Transformers: Value mapper

 

There are 2 ways to do it:

1st option: 

Accessor: Pattern accessor

Pattern: company.name

 

2nd option:

Accessor: Key accessor 

Root: company

Key: name

 

Mappers: standard

From*: string “Abernathy Group”

To*: string “Foobar”

Comparator: adaptive equals comparison  (it will only check for the value and not for the data type)

 

Mappers: Dictionary map

Map*: string “Abernathy Group” (if it says “Abernathy Group”)

          string “Foo” (make it “Foo”)

 

          string “Abernathy Group 100” (but if it says “Abernathy Group 100”)

          string “Bar” (make it “Bar”)