_extractText(self, format) -> PyObject *

def _extractText(self, format):
        """_extractText(self, format) -> PyObject *"""
        val = _fitz.TextPage__extractText(self, format)

        if format != 2:
            return val
        import base64, json

        class b64encode(json.JSONEncoder):
            def default(self,s):
                if not fitz_py2 and type(s) is bytes:
                    return base64.b64encode(s).decode()
                if type(s) is bytearray:
                    if fitz_py2:
                        return base64.b64encode(s)
                    else:
                        return base64.b64encode(s).decode()

        val = json.dumps(val, separators=(",", ":"), cls=b64encode, indent=1)


        return val