JsonRepresentation asPayloadRepr(final RendererContext rendererContext, EventPayload payload) {
final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(rendererContext, null, JsonRepresentation.newMap());
final ObjectAdapter objectAdapter = rendererContext.getAdapterManager().adapterFor(payload);
renderer.with(objectAdapter).asEventSerialization();
return renderer.render();
}
String jsonFor(final Object object) {
try {
return getJsonMapper().write(object);