Fallback to encode vars(obj)
diff --git a/src/_encoder.pyx b/src/_encoder.pyx
index 80dd2c4..82a6186 100644
--- a/src/_encoder.pyx
+++ b/src/_encoder.pyx
@@ -349,11 +349,23 @@
 
 
 cdef int _encode_unstringifiable(WriterRef writer, object data) except -1:
-    if expect(not data, True):
+    if not data:
         writer.append_s(writer, b'none', 4)
-    else:
-        _raise_unstringifiable(data)
-    return True
+        return True
+
+    Py_EnterRecursiveCall(' while encoding JSON5 object with vars(obj) fallback')
+    try:
+        try:
+            data = PyObject_GenericGetDict(data, NULL)
+        except:
+            pass
+        else:
+            if _encode_mapping(writer, data):
+                return True
+    finally:
+        Py_LeaveRecursiveCall()
+
+    _raise_unstringifiable(data)
 
 
 cdef int _encode_other(WriterRef writer, object data):
diff --git a/src/_imports.pyx b/src/_imports.pyx
index 7af9493..c4f39ed 100644
--- a/src/_imports.pyx
+++ b/src/_imports.pyx
@@ -197,6 +197,7 @@
     void ObjectFree 'PyObject_Free'(void *p)
     object ObjectInit 'PyObject_INIT'(PyObject *obj, type cls)
     PyVarObject *ObjectInitVar 'PyObject_InitVar'(PyVarObject *obj, type cls, Py_ssize_t size)
+    object PyObject_GenericGetDict(object o, void *context)
 
     object PyLong_FromString(const char *str, char **pend, int base)