Length in using expression

Hi,
I have a scenario where I need to filter out json based on length of a particular element.
so in Source if json is like this:-
[
{
“SaleDatas”: {
“DataId”: “”,
“AmazonDataId”: “Sale.purchase_4”,
“AmazonDataName”: “”,
“Name”: “Sale.purchase_4”,
“DataType”: “”,
“Value”: “Windows 11 Pro”,
“AmazonDataIdf”: “”
}
},
{
“SaleDatas”: {
“DataId”: “”,
“AmazonDataId”: “2036”,
“AmazonDataName”: “”,
“Name”: “colour_name”,
“DataType”: “”,
“Value”: “Platinum”,
“AmazonDataIdf”: “”
}
}
]

in target I need only :-
[
{
“SaleDatas”: {
“DataId”: “”,
“AmazonDataId”: “2036”,
“AmazonDataName”: “”,
“Name”: “supplier_colour_name”,
“DataType”: “”,
“Value”: “Platinum”,
“AmazonDataIdf”: “”
}
}
]

I need a filter snaps expession either using length or numeric of “AmazonDataId”. i.e if AmazonDataId.length==‘4’ then only pass through filter snaps.

Hi @Sahil,

Are you looking for something like this.

Expression for Mapper:
Array.filter(el => el.SaleDates.AmazonDataId.length == 4)

Expression for Filter:
$SaleDates.AmazonDataId.length == 4

Regards,
Viktor