jeudi 7 janvier 2016

filter single element from a multi value element in JSON

In my test i need to compare the expected and actual JSON response. But the Json response is limited depending upon the role. So i need to exclude certain fields while comparing. Below is the Json and i want to filter out 2 things from it.
1. CompanyId 2. status.

{
userId=dg4d6g4dg45-rgdre-543-dfg,
userName=test123,
effectives=[  
   {  
     companyId=345634-54-547-74,
     companyName=xyz,
     roleId=685-345863490-634,
     roleName=This is the test Role
  },
  {  
     companyId=345634-54-547-74,
     companyName=xyz,
     roleId=685-345863490-634,
     roleName=This is the test Role
  }
],
status=Active
}

Can you someone please let me know how to achieve this. I explored the filterOutAllExcep method of SimpleBeanPropertyFilter but then i will have to figure out the logic to remember all the fields that should be included as well.

Aucun commentaire:

Enregistrer un commentaire