public static Object convertValueToSafeJson ( Converter converter , Object value ) { value = Proxies . unwrap ( value ) ; if ( isJsonObject ( value ) ) { return value ; } if ( converter != null ) { // TODO converters ususally go from String -> CustomType? try { Object converted = converter . convert ( value ) ; if ( converted != null ) { value = converted ; } } catch ( Exception e ) { // ignore - invalid converter } } if ( value != null ) { return toSafeJsonValue ( value ) ; } else { return null ; } }
Uses the given converter to convert to a nicer UI value and return the JSON safe version