components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
public String asJson(SlackMessage message) {
        Map<String, Object> jsonMap = new HashMap<>();

        // Put the values in a map
        jsonMap.put(SlackConstants.SLACK_TEXT_FIELD, message.getText());
        jsonMap.put(SlackConstants.SLACK_CHANNEL_FIELD, message.getChannel());
        jsonMap.put(SlackConstants.SLACK_USERNAME_FIELD, message.getUsername());
        jsonMap.put(SlackConstants.SLACK_ICON_URL_FIELD, message.getIconUrl());
        jsonMap.put(SlackConstants.SLACK_ICON_EMOJI_FIELD, message.getIconEmoji());

        List<SlackMessage.Attachment> attachments = message.getAttachments();
        if (attachments != null && !attachments.isEmpty()) {
            buildAttachmentJson(jsonMap, attachments);
        }

        // Return the string based on the JSON Object
        return new JsonObject(jsonMap).toJson();
    }
/**
     * Returns a JSON string to be posted to the Slack API
     *
     * @return JSON string
     */
Returns a JSON string to be posted to the Slack API
@return JSON string
Returns a JSON string to be posted to the Slack API @return JSON string
public String asJson(SlackMessage message) {
        Map<String, Object> jsonMap = new HashMap<>();
        jsonMap.put(SlackConstants.SLACK_TEXT_FIELD, message.getText());
        jsonMap.put(SlackConstants.SLACK_CHANNEL_FIELD, message.getChannel());
        jsonMap.put(SlackConstants.SLACK_USERNAME_FIELD, message.getUsername());
        jsonMap.put(SlackConstants.SLACK_ICON_URL_FIELD, message.getIconUrl());
        jsonMap.put(SlackConstants.SLACK_ICON_EMOJI_FIELD, message.getIconEmoji());
        List<SlackMessage.Attachment> attachments = message.getAttachments();
        if (attachments != null && !attachments.isEmpty()) {
            buildAttachmentJson(jsonMap, attachments);
        }
        return new JsonObject(jsonMap).toJson();
    }
public String asJson ( SlackMessage message ) { Map < String , Object > jsonMap = new HashMap < > ( ) ; jsonMap . put ( SlackConstants . SLACK_TEXT_FIELD , message . getText ( ) ) ; jsonMap . put ( SlackConstants . SLACK_CHANNEL_FIELD , message . getChannel ( ) ) ; jsonMap . put ( SlackConstants . SLACK_USERNAME_FIELD , message . getUsername ( ) ) ; jsonMap . put ( SlackConstants . SLACK_ICON_URL_FIELD , message . getIconUrl ( ) ) ; jsonMap . put ( SlackConstants . SLACK_ICON_EMOJI_FIELD , message . getIconEmoji ( ) ) ; List < SlackMessage . Attachment > attachments = message . getAttachments ( ) ; if ( attachments != null && ! attachments . isEmpty ( ) ) { buildAttachmentJson ( jsonMap , attachments ) ; } return new JsonObject ( jsonMap ) . toJson ( ) ; }
Returns a JSON string to be posted to the Slack API
 @return JSON string
Returns a JSON string to be posted to the Slack API @return JSON string
// Put the values in a map // Return the string based on the JSON Object