class JsonUtils {

    public static void merge(JsonNode src, JsonNode target) {
        Iterator<Map.Entry<String, JsonNode>> fields = src.fields();
        while (fields.hasNext()) {
            Map.Entry<String, JsonNode> entry = fields.next();
            JsonNode subNode = entry.getValue();
            switch (subNode.getNodeType()) {
                case OBJECT:
                    writeObject(entry, target);
                    break;
                case ARRAY:
                    writeArray(entry, target);
                    break;
                case STRING:
                    updateObject(target, new TextNode(entry.getValue().textValue()), entry);
                    break;
                case NUMBER:
                    updateObject(target, new IntNode(entry.getValue().intValue()), entry);
                    break;
                case BOOLEAN:
                    updateObject(target, BooleanNode.valueOf(entry.getValue().booleanValue()), entry);
                    break;
                default:
                    logger.warn("Unrecognized data type {} "+subNode.getNodeType());
            }
        }
    }

    private  JsonUtils();

}