title: Java Spring filtering JSON
body: <p>I'm trying to find best way how to filter JSON according to its values. I have a JSON file and I need to return only subset of data according to used filters. </p>
  
  <pre><code>    {"employees":[
          {"firstName":"John", "lastName":"Doe"}, 
          {"firstName":"Anna", "lastName":"Smith"},
          {"firstName":"Peter", "lastName":"Jones"},
          {"firstName":"Jake", "lastName":"Smith"}
      ]}
  </code></pre>
  
  <p>Let's say I want to return only those whose lastName is Smith. Since I get the parameter value in controller there is no easy way how to pass it dao layer and change the getter there. </p>
  
  <p>Of course I could do it by going through array with object and save only those who fit the condition but for big data that would be really inefficient. I bet there is better way of doing this.</p>
  
  <p>@JSONview and filter doesn't seem to help my problem, they can hide and reveal all the fields and I want to do that with values not fields. Is there an easy way of doing this or I need to filter it manually?</p>
  
  <p>Thanks.</p>