class JsonSerializer extends AbstractSerializer {

    @Setter
    @Getter
    private ObjectMapper objectMapper;

    private Class<? extends Object> clazz;

    public JsonSerializer() {
        this(Object.class);
        objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    }

    /**
     * <p>Constructor for JsonSerializer.</p>
     *
     * @param clazz a {@link Class} object
     */
    public JsonSerializer(final Class<? extends Object> clazz) {
        assertNotNull("clazz", clazz);
        this.clazz = clazz;

        objectMapper = new ObjectMapper();
        objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
        objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
    }

    /** {@inheritDoc} */
    @Override
    protected String internalSerializeToString(final Object obj) {<FILL_FUNCTION_BODY>}

    /** {@inheritDoc} */
    @Override
    protected Object internalDeserializeFromString(final String encoded) {
        try {
            return objectMapper.readValue(encoded, clazz);
        } catch (final JsonProcessingException e) {
            LOGGER.error("Cannot decode string", e);
            return null;
        }
    }
}

        try {
            return objectMapper.writeValueAsString(obj);
        } catch (final JsonProcessingException e) {
            LOGGER.error("Cannot encode object", e);
            return null;
        }
    
<methods>public non-sealed void <init>() ,public final java.lang.Object deserializeFromBytes(byte[]) ,public final java.lang.Object deserializeFromString(java.lang.String) ,public final byte[] serializeToBytes(java.lang.Object) ,public final java.lang.String serializeToString(java.lang.Object) <variables>