static Map < String , Object > fromWire ( Map < String , Object > json ) { return ( Map < String , Object > ) ObjectIterator . iterate ( json , new Closure < ObjectIterator . IterateBean , Object > ( ) { @ Override public Object call ( ObjectIterator . IterateBean i ) { if ( i . getValue ( ) instanceof String ) { String s = ( String ) i . getValue ( ) ; try { if ( s . startsWith ( "/" ) && s . endsWith ( "/" ) ) { s = s . substring ( 1 , s . length ( ) - 1 ) ; String type = s . substring ( 0 , s . indexOf ( "(" ) ) ; String value = s . substring ( s . indexOf ( "(" ) + 1 , s . lastIndexOf ( ")" ) ) ; if ( "Date" . equalsIgnoreCase ( type ) ) { return ObjectType . cast ( value , Date . class ) ; } } } catch ( Throwable e ) { } } return i . getValue ( ) ; } } ) ; }
Parse simple types into Java Classes