private <V> V convertToMap(ValueMap valueMap) {
        final Map<String, Object> map = new LinkedHashMap<>(valueMap.size());

        valueMap.entrySet().forEach(new Consumer<Map.Entry<String, Object>>() {
            @Override
            public void accept(Map.Entry<String, Object> entry) {

                Object value = entry.getValue();

                /* If the value is a value container then grab what is inside. */
                if (value instanceof ValueContainer) {
                    ValueContainer valueContainer = ((ValueContainer) entry.getValue());
                    value = valueContainer.toValue();
                }

                /* If value is a Value then pull the real value. */
                if (value instanceof Value) {
                    map.put(entry.getKey(), ((Value) value).toValue());
                } else if (value instanceof ValueMap) {
                    /* If value is a value map then convert it into a regular map. */
                    map.put(entry.getKey(), convertToMap(((ValueMap) value)));
                } else if (value instanceof List) {
                    map.put(entry.getKey(), convertList(value, mapper.get()));
                } else {
                    map.put(entry.getKey(), value);
                }

            }
        });

        return (V) map;
    }
private <V> V convertToMap(ValueMap valueMap) {
        final Map<String, Object> map = new LinkedHashMap<>(valueMap.size());

        valueMap.entrySet().forEach(new Consumer<Map.Entry<String, Object>>() {
            @Override
            public void accept(Map.Entry<String, Object> entry) {

                Object value = entry.getValue();

                
                if (value instanceof ValueContainer) {
                    ValueContainer valueContainer = ((ValueContainer) entry.getValue());
                    value = valueContainer.toValue();
                }

                
                if (value instanceof Value) {
                    map.put(entry.getKey(), ((Value) value).toValue());
                } else if (value instanceof ValueMap) {
                    
                    map.put(entry.getKey(), convertToMap(((ValueMap) value)));
                } else if (value instanceof List) {
                    map.put(entry.getKey(), convertList(value, mapper.get()));
                } else {
                    map.put(entry.getKey(), value);
                }

            }
        });

        return (V) map;
    }
private < V > V convertToMap ( ValueMap valueMap ) { final Map < String , Object > map = new LinkedHashMap <> ( valueMap . size ( ) ) ; valueMap . entrySet ( ) . forEach ( new Consumer < Map . Entry < String , Object > > ( ) { @ Override public void accept ( Map . Entry < String , Object > entry ) { Object value = entry . getValue ( ) ; /* If the value is a value container then grab what is inside. */ if ( value instanceof ValueContainer ) { ValueContainer valueContainer = ( ( ValueContainer ) entry . getValue ( ) ) ; value = valueContainer . toValue ( ) ; } /* If value is a Value then pull the real value. */ if ( value instanceof Value ) { map . put ( entry . getKey ( ) , ( ( Value ) value ) . toValue ( ) ) ; } else if ( value instanceof ValueMap ) { /* If value is a value map then convert it into a regular map. */ map . put ( entry . getKey ( ) , convertToMap ( ( ( ValueMap ) value ) ) ) ; } else if ( value instanceof List ) { map . put ( entry . getKey ( ) , convertList ( value , mapper . get ( ) ) ) ; } else { map . put ( entry . getKey ( ) , value ) ; } } } ) ; return ( V ) map ; }
Helper method.
Converts a value map into a regular map of Java basic types.

@param valueMap valueMap
@param <V>      V
@return regular map
Helper method . Converts a value map into a regular map of Java basic types .