I haven’t tested this, but I think something like this would do what you want:
import org.codehaus.jackson.node.ObjectNode;
// ...
for (JsonNode personNode : rootNode) {
if (personNode instanceof ObjectNode) {
ObjectNode object = (ObjectNode) personNode;
object.remove("familyName");
object.remove("middleName");
}
}
You could also do this more efficiently using Jackon’s raw parsing API, but the code would be a lot messier.