diff -urN a/pandas/_libs/src/ujson/python/objToJSON.c b/pandas/_libs/src/ujson/python/objToJSON.c
--- a/pandas/_libs/src/ujson/python/objToJSON.c	2021-12-12 13:20:47.000000000 +0300
+++ b/pandas/_libs/src/ujson/python/objToJSON.c	2022-01-05 14:19:39.925323550 +0300
@@ -55,6 +55,7 @@
 static PyTypeObject *cls_series;
 static PyTypeObject *cls_index;
 static PyTypeObject *cls_nat;
+static PyTypeObject *cls_np_datetime_oob;
 static PyTypeObject *cls_na;
 PyObject *cls_timedelta;
 
@@ -149,6 +150,7 @@
 void *initObjToJSON(void) {
     PyObject *mod_pandas;
     PyObject *mod_nattype;
+    PyObject *mod_np_datetime;
     PyObject *mod_natype;
     PyObject *mod_decimal = PyImport_ImportModule("decimal");
     type_decimal =
@@ -174,6 +176,14 @@
         Py_DECREF(mod_nattype);
     }
 
+    mod_np_datetime = PyImport_ImportModule("pandas._libs.tslibs.np_datetime");
+    if (mod_np_datetime) {
+        cls_np_datetime_oob = 
+            (PyTypeObject*)PyObject_GetAttrString(mod_np_datetime,
+                                                  "OutOfBoundsDatetime");
+        Py_DECREF(mod_np_datetime);
+    }
+
     mod_natype = PyImport_ImportModule("pandas._libs.missing");
     if (mod_natype) {
         cls_na = (PyTypeObject *)PyObject_GetAttrString(mod_natype, "NAType");