title: Remove a nested JSON object with particular key, value with Jackson
body: <p>I want to remove blob columns from JSON objects.
  I need to check if any of the object has &quot;@type&quot;: &quot;blob&quot;, the entire column should be dropped.
  Ex. following is a record from a DB. 'experience', 'hitpoints', 'name', 'uuid', 'image' (optional) are the columns. since the record has a blob column i.e image. It should be dropped.</p>
  <p>Sample I/P:</p>
  <pre><code>  {
        &quot;experience&quot;: 14248,
        &quot;hitpoints&quot;: 9223372036854775807,
        &quot;name&quot;: &quot;Aaron1&quot;,
        &quot;uuid&quot;: &quot;78edf902-7dd2-49a4-99b4-1c94ee286a33&quot;,
        &quot;image&quot;: {
          &quot;@type&quot;: &quot;blob&quot;,
          &quot;content_type&quot;: &quot;image/jpeg&quot;,
          &quot;digest&quot;: &quot;sha1–4xlj1AKFgLdzcD7a1pVChrVTJIc=&quot;,
          &quot;length&quot;: 3888349
        }
      },
      {
       &quot;experience&quot;: 14252,
       &quot;hitpoints&quot;: 92233720368512345,
       &quot;name&quot;: &quot;Aaron2&quot;,
       &quot;uuid&quot;: &quot;78edf902-7dd2-49a4-99b4-1a94ff286a45&quot;,
      }
  </code></pre>
  <p>Sample O/P:</p>
  <pre><code>{
    &quot;experience&quot;: 14248,
    &quot;hitpoints&quot;: 9223372036854775807,
    &quot;name&quot;: &quot;Aaron1&quot;,
    &quot;uuid&quot;: &quot;78edf902-7dd2-49a4-99b4-1c94ee286a33&quot;,
  },
  {
    &quot;experience&quot;: 14252,
    &quot;hitpoints&quot;: 92233720368512345,
    &quot;name&quot;: &quot;Aaron2&quot;,
    &quot;uuid&quot;: &quot;78edf902-7dd2-49a4-99b4-1a94ff286a45&quot;,
   }
  </code></pre>
  <p>Is there a way to achieve this by using optimized JSON parsing.
  Currently, my logic follows the steps:</p>
  <ol>
  <li>I'm parsing through the entire object using a function where I'm looping through the node to read the object.</li>
  <li>Calling the 'blobChecker' function on every object.</li>
  <li>Assigning null to the node if it contains blob.</li>
  <li>Skipping the null node in the original function that invokes 'blobChecker'</li>
  </ol>
  <p>The original function to parseJSON:</p>
  <pre><code>parseJsonNode(JsonNode node){
  blobNodeChecker(node);
  if(node!=null)
  //The funtionality
  }
  </code></pre>
  <p>The blobNodeChecker Function:</p>
  <pre><code>blobNodeChecker(JsonNode node) {
  Boolean isBlob = false;
  String blobNode = null;
  Iterator&lt;Map.Entry&lt;String, JsonNode&gt;&gt; fields = node.fields();
  while (fields.hasNext()) {
      Map.Entry&lt;String, JsonNode&gt; next = fields.next();
      String key = next.getKey();
      String val = next.getValue().toString().toLowerCase();
      if (key.equals(&quot;@type&quot;)) {
          if (val.contains(&quot;blob&quot;)) {
              isBlob = true;
              break;
      }
      }
  }
  if (isBlob) {
      node = null;
  }
  return node;
  }
  </code></pre>