question: public String decode ( String encoded ) { JsonObject object = new JsonObject ( encoded ) ; JsonArray headers = object . getJsonArray ( "headers" ) ; for ( Object headerObj : headers ) { JsonArray header = ( JsonArray ) headerObj ; String key = header . getString ( 0 ) ; String value = header . getString ( 1 ) ; if ( key . equalsIgnoreCase ( CONTENT_TYPE ) && ( value . contains ( "text/" ) || value . contains ( APPLICATION_JSON ) ) ) { try { object . put ( "payloadObject" , new JsonObject ( new String ( object . getBinary ( PAYLOAD ) , Charset . forName ( UTF_8 ) ) ) ) ; } catch ( DecodeException e ) { object . put ( "payloadString" , new String ( object . getBinary ( PAYLOAD ) , Charset . forName ( UTF_8 ) ) ) ; } object . remove ( PAYLOAD ) ; break ; } } return object . toString ( ) ; }
target:  Decode the payload if the content-type is text or json.