title: How to remove empty node in JsonNode
body: <p>i have some json, like this:</p>
  
  <pre><code>String str = "{\"menu\":[{\"form1\":\"nameForm1\"}, {\"form2\":\"nameForm2\"}]}";
  ObjectMapper objectMapper = new ObjectMapper();
  JsonNode testNode = objectMapper.readTree(str);
  </code></pre>
  
  <p>After some actions, I modified my json. for example</p>
  
  <pre><code>Iterator&lt;Map.Entry&lt;String, JsonNode&gt;&gt; fieldIterator = testNode.fields();
  while (fieldIterator.hasNext()) {
      Map.Entry&lt;String, JsonNode&gt; entry = fieldIterator.next();
      if (entry.getValue().isArray()){
          for (JsonNode arrayNode : entry.getValue()){
              if (arrayNode.path("form2").isMissingNode()) {
                  ((ObjectNode) arrayNode).removeAll();
             }
          }
      }
  }
  </code></pre>
  
  <p>And my json began to look like:</p>
  
  <pre><code>{"menu":[{},{"form2":"nameForm2"}]}
  </code></pre>
  
  <p>How can I get json without empty array elements, i.e.</p>
  
  <pre><code>{"menu":[{"form2":"nameForm2"}]}
  </code></pre>