cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter json document based on keys present in another object

Ajay_Chawda
Contributor

Hello Experts.
i want to filter json object based on keys present in another object of same document.

I have one json object which hold key information.
As end result we should consider only those values which has key value matching with json object which hold key information.
image

group object holds key information.
i should only consider value matching with key values from group object.

Regards,
Ajay
input_doc.txt (1.2 KB)

2 REPLIES 2

Cele
New Contributor II

Hi @Ajay_Chawda

Try to use the following expression and let me know if this helps you

$.entries().filter(item =>  $group.findIndex(x => x.name == item[0]) != -1 ).reduce((acc, cur) => acc.extend({[cur[0]]: cur[1]}),{})

BR
Kristijan

@Cele
Thank you for help.
it worked .

Regards,
Ajay