src/main/java/com/arpnetworking/logback/serialization/steno/MapSerialziationStrategy.java
public String serialize(
            final ILoggingEvent event,
            final String eventName,
            @Nullable final Map<String, ? extends Object> map)
            throws Exception {
        final StringWriter jsonWriter = new StringWriter();
        final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter);

        // Start wrapper
        StenoSerializationHelper.startStenoWrapper(event, eventName, jsonGenerator, _objectMapper);

        // Write event data
        jsonGenerator.writeObjectFieldStart("data");
        if (map != null) {
            for (final Map.Entry<String, ? extends Object> entry : map.entrySet()) {
                if (StenoSerializationHelper.isSimpleType(entry.getValue())) {
                    jsonGenerator.writeObjectField(entry.getKey(), entry.getValue());
                } else {
                    jsonGenerator.writeFieldName(entry.getKey());
                    _objectMapper.writeValue(
                            jsonGenerator,
                            entry.getValue());
                }
            }
        }
        jsonGenerator.writeEndObject(); // End 'data' field

        // Output throwable
        StenoSerializationHelper.writeThrowable(event.getThrowableProxy(), jsonGenerator, _objectMapper);

        // End wrapper
        StenoSerializationHelper.endStenoWrapper(event, eventName, jsonGenerator, _objectMapper, _encoder);

        return jsonWriter.toString();
    }
public String serialize(
            final ILoggingEvent event,
            final String eventName,
            @Nullable final Map<String, ? extends Object> map)
            throws Exception {
        final StringWriter jsonWriter = new StringWriter();
        final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter);

        // Start wrapper
        StenoSerializationHelper.startStenoWrapper(event, eventName, jsonGenerator, _objectMapper);

        // Write event data
        jsonGenerator.writeObjectFieldStart("data");
        if (map != null) {
            for (final Map.Entry<String, ? extends Object> entry : map.entrySet()) {
                if (StenoSerializationHelper.isSimpleType(entry.getValue())) {
                    jsonGenerator.writeObjectField(entry.getKey(), entry.getValue());
                } else {
                    jsonGenerator.writeFieldName(entry.getKey());
                    _objectMapper.writeValue(
                            jsonGenerator,
                            entry.getValue());
                }
            }
        }
        jsonGenerator.writeEndObject(); // End 'data' field

        // Output throwable
        StenoSerializationHelper.writeThrowable(event.getThrowableProxy(), jsonGenerator, _objectMapper);

        // End wrapper
        StenoSerializationHelper.endStenoWrapper(event, eventName, jsonGenerator, _objectMapper, _encoder);

        return jsonWriter.toString();
    }
public String serialize ( final ILoggingEvent event , final String eventName , @ Nullable final Map < String , ? extends Object > map ) throws Exception { final StringWriter jsonWriter = new StringWriter ( ) ; final JsonGenerator jsonGenerator = _jsonFactory . createGenerator ( jsonWriter ) ; // Start wrapper StenoSerializationHelper . startStenoWrapper ( event , eventName , jsonGenerator , _objectMapper ) ; // Write event data jsonGenerator . writeObjectFieldStart ( "data" ) ; if ( map != null ) { for ( final Map . Entry < String , ? extends Object > entry : map . entrySet ( ) ) { if ( StenoSerializationHelper . isSimpleType ( entry . getValue ( ) ) ) { jsonGenerator . writeObjectField ( entry . getKey ( ) , entry . getValue ( ) ) ; } else { jsonGenerator . writeFieldName ( entry . getKey ( ) ) ; _objectMapper . writeValue ( jsonGenerator , entry . getValue ( ) ) ; } } } jsonGenerator . writeEndObject ( ) ; // End 'data' field // Output throwable StenoSerializationHelper . writeThrowable ( event . getThrowableProxy ( ) , jsonGenerator , _objectMapper ) ; // End wrapper StenoSerializationHelper . endStenoWrapper ( event , eventName , jsonGenerator , _objectMapper , _encoder ) ; return jsonWriter . toString ( ) ; }
Serialize an event.

@param event The event.
@param eventName The event name.
@param map The message key to value pairs.
@return Serialization of message as a <code>String</code>.
@throws Exception Serialization may throw any <code>Exception</code>.
Serialize an event .