private JSONObject makeActionSkeleton ( Action a ) { JSONObject o = new JSONObject ( ) ; o . put ( START_LABEL , a . getStart ( ) ) ; o . put ( END_LABEL , a . getEnd ( ) ) ; JSONObject hooks = new JSONObject ( ) ; for ( Action . Hook k : Action . Hook . values ( ) ) { JSONArray arr = new JSONArray ( ) ; for ( Event e : a . getEvents ( k ) ) { arr . add ( toJSON ( e ) ) ; } hooks . put ( k . toString ( ) , arr ) ; } o . put ( HOOK_LABEL , hooks ) ; return o ; }
Just create the JSONObject and set the consume and the end attribute .