code: @Override
      public String write( T value, JsonSerializationContext ctx ) throws JsonSerializationException {
          JsonWriter writer = ctx.newJsonWriter();
          try {
              if ( ctx.isWrapRootValue() ) {
                  writer.beginObject();
                  writer.name( rootName );
                  getSerializer().serialize( writer, value, ctx );
                  writer.endObject();
              } else {
                  getSerializer().serialize( writer, value, ctx );
              }
              return writer.getOutput();
          } catch ( JsonSerializationException e ) {
              // already logged, we just throw it
              throw e;
          } catch ( RuntimeException e ) {
              throw ctx.traceError( value, e, writer );
          }
      }
docs: {@inheritDoc}