@Override
    protected void initializeSegment(SegmentConfig segment) throws BeanIOConfigurationException {
        super.initializeSegment(segment);
        
        // default the JSON name to the segment name
        if (segment.getJsonName() == null) {
            segment.setJsonName(segment.getName());
        }
        
        // default the JSON type to 'object' if the segment is bound to bean object, or 'none' otherwise
        if (segment.getJsonType() == null) {
            if (segment.getType() != null) {
                segment.setJsonType(PropertyConfig.JSON_TYPE_OBJECT);
                segment.setJsonArray(segment.isRepeating());
            }
            else {
                segment.setJsonType(PropertyConfig.JSON_TYPE_NONE);
            }
        }
        // otherwise validate the type
        else {
            String type = segment.getJsonType();
            if (type.endsWith("[]")) {
                type = type.substring(0, type.length() - 2);
                segment.setJsonArray(true);
            }
            else if (segment.isRepeating() && segment.getComponentType() != ComponentConfig.RECORD) {
                throw new BeanIOConfigurationException("Invalid jsonType '" + segment.getJsonType() + "', expected 'object[]'");
            }
            
            if (!PropertyConfig.JSON_TYPE_OBJECT.equals(type) &&
                !PropertyConfig.JSON_TYPE_NONE.equals(type) &&
                !PropertyConfig.JSON_TYPE_ARRAY.equals(type)) {
                throw new BeanIOConfigurationException("Invalid jsonType '" + segment.getJsonType() + "'");
            }
            
            segment.setJsonType(type);
        }
    }