static Map < String , Object > toWire ( Map < String , Object > json ) { return ( Map < String , Object > ) ObjectIterator . iterate ( json , new Closure < ObjectIterator . IterateBean , Object > ( ) { @ Override public Object call ( ObjectIterator . IterateBean i ) { try { if ( i . getValue ( ) instanceof Date ) { SimpleDateFormat sdf = new SimpleDateFormat ( "yyy-MM-dd HH:mm:ss.SSS" ) ; //return "/Date(" + ((Date) i.getValue()).getTime() + ")/"; return "/Date(" + sdf . format ( ( Date ) i . getValue ( ) ) + ")/" ; } } catch ( Exception e ) { } return i . getValue ( ) ; } } ) ; }
Format Java Classes into strings version