@Override
    public void serialize(Object obj, StringBuilder buf){
            
        obj = Bytes.applyEncodingHooks( obj );
        
        if(obj == null) {
            buf.append(" null ");
            return;
        }
        
        ObjectSerializer serializer = null;
        
        List<Class<?>> ancestors;
        ancestors = ClassMap.getAncestry(obj.getClass());

        for (final Class<?> ancestor : ancestors) {
            serializer = _serializers.get(ancestor);
            if (serializer != null)
                break;
        }
        
        if (serializer == null && obj.getClass().isArray())
            serializer = _serializers.get(Object[].class);
        
        if (serializer == null)
            throw new RuntimeException( "json can't serialize type : " + obj.getClass() );
        
        serializer.serialize(obj, buf);
    }