cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable specific key using Mapper snap

kishore505
New Contributor

I've a problem with disabling a specific key in a room[] array. I've tried many ways but still haven't found any solution.

am trying to disable in area key in room[] array.

My Inputs

{
"house": {
"room": [ 
{
"name": "Bedroom",
"area": 10
}, 
{
"name": "Bathroom",
"area": 9
}, 
{
"name": "Kitchen",
"area": 12
}
],
"garden": {
"area": 150
}
}
}
 
And my desired output is something like this:
{
"house": {
"room": [{
"name": "Bedroom"
},
{
"name": "Bathroom"
},
{
"name": "Kitchen"
}
],
"garden": {
"area": 150
}
}
}
2 REPLIES 2

ddellsperger
Employee
Employee

This is actually a pretty good use case for our Structure Snap.  It allows for these kinds of operations to be a bit more simplified, you can achieve this using the Structure snap with the following settings:

ddellsperger_0-1694782356823.png

In this case, it's key that pass through is set to "yes" as it will then allow you to modify the input document in-place, when you select "delete" you don't need to set a target path.  Doing this through a mapper might be a bit more difficult to achieve because you'd effectively have to re-build the house.room array.

koryknick
Employee
Employee

@kishore505 - another option is to use the Mapping Root in the Mapper snap to affect only that sub-element of the incoming document.  For example, assuming your input, configure a Mapper as follows:

koryknick_0-1694782968040.png

Which gives the following output:

koryknick_1-1694783012301.png