diff --git a/web/pgadmin/browser/server_groups/__init__.py b/web/pgadmin/browser/server_groups/__init__.py
index 8529aee..dc57aa7 100644
--- a/web/pgadmin/browser/server_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/__init__.py
@@ -156,7 +156,9 @@ class ServerGroupView(NodeView):
             user_id=current_user.id,
             id=gid).first()
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         if servergroup is None:
             return make_json_response(
@@ -201,7 +203,9 @@ class ServerGroupView(NodeView):
             )
 
     def create(self):
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         if data[u'name'] != '':
             try:
                 check_sg = ServerGroup.query.filter_by(
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 329cd7b..568a69e 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -400,7 +400,9 @@ class ServerNode(PGChildNodeView):
         }
 
         idx = 0
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         from pgadmin.utils.driver import get_driver
         manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
@@ -554,7 +556,9 @@ class ServerNode(PGChildNodeView):
             u'role'
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for arg in required_args:
             if arg not in data:
@@ -608,10 +612,16 @@ class ServerNode(PGChildNodeView):
                 if not status:
                     db.session.delete(server)
                     db.session.commit()
+
+                    if getattr(errmsg, 'decode'):
+                        errmsg = errmsg.decode('utf-8')
+
                     return make_json_response(
                         status=401,
                         success=0,
-                        errormsg=gettext("Unable to connect to server:\n\n%s" % errmsg)
+                        errormsg=gettext(
+                            "Unable to connect to server:\n\n{0}"
+                        ).format(errmsg)
                     )
                 else:
                     user = manager.user_info
@@ -740,8 +750,11 @@ class ServerNode(PGChildNodeView):
         if user is None:
             return unauthorized(gettext("Unauthorized request."))
 
-        data = request.form if request.form else json.loads(request.data) if \
-            request.data else {}
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        ) if request.data and hasattr(
+            request.data, 'decode'
+        ) else request.data or {}
 
         password = None
         save_password = False
@@ -795,8 +808,12 @@ class ServerNode(PGChildNodeView):
                 return internal_server_error(errormsg=str(e))
 
         if not status:
+            if getattr(errmsg, 'decode'):
+                errmsg = errmsg.decode('utf-8')
             current_app.logger.error(
-                "Could not connected to server(#{0}) - '{1}'.\nError: {2}".format(
+                gettext(
+                    "Could not connected to server(#{0}) - '{1}'.\nError: {2}"
+                ).format(
                     server.id, server.name, errmsg
                 )
             )
@@ -969,7 +986,10 @@ class ServerNode(PGChildNodeView):
             sid: Server id
         """
         try:
-            data = json.loads(request.form['data'])
+            data = request.form['data']
+            data = json.loads(
+                data.decode('utf-8') if hasattr(data, 'decode') else data
+            )
             if data and ('password' not in data or
                                  data['password'] == '' or
                                  'newPassword' not in data or
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 1f7fd07..adea626 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -441,7 +441,9 @@ class DatabaseView(PGChildNodeView):
             u'name'
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for arg in required_args:
             if arg not in data:
@@ -515,7 +517,7 @@ class DatabaseView(PGChildNodeView):
         """Update the database."""
 
         data = request.form if request.form else json.loads(
-            request.data.decode()
+            request.data.decode('utf-8')
         )
         info = "nothing to update."
 
@@ -632,7 +634,9 @@ class DatabaseView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index 5c5d5b6..289b4ad 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -19,7 +19,7 @@ from pgadmin.browser.collection import CollectionNodeModule
 from pgadmin.browser.utils import PGChildNodeView
 from pgadmin.utils.ajax import make_json_response, \
     make_response as ajax_response, internal_server_error
-from pgadmin.utils.ajax import precondition_required
+from pgadmin.utils.ajax import precondition_required, gone
 from pgadmin.utils.driver import get_driver
 
 from config import PG_DEFAULT_DRIVER
@@ -323,7 +323,6 @@ class CastView(PGChildNodeView):
 
         if not status:
             return internal_server_error(errormsg=res)
-        result = res['rows'][0]
 
         return ajax_response(
             response=res['rows'][0],
@@ -345,7 +344,9 @@ class CastView(PGChildNodeView):
             'trgtyp'
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -396,7 +397,9 @@ class CastView(PGChildNodeView):
         :param gid: group id
         :return:
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         sql = self.get_sql(gid, sid, did, data, cid)
         try:
             if sql and sql.strip('\n') and sql.strip(' '):
@@ -549,7 +552,9 @@ class CastView(PGChildNodeView):
         :return:
         """
         res = []
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         sql = render_template("/".join([self.template_path, 'functions.sql']),
                               srctyp=data['srctyp'],
                               trgtyp=data['trgtyp'])
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
index b105249..bd2102a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
@@ -319,7 +319,9 @@ class EventTriggerView(PGChildNodeView):
         Returns:
 
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         required_args = {
             'name': 'Name',
             'eventowner': 'Owner',
@@ -382,7 +384,9 @@ class EventTriggerView(PGChildNodeView):
         Returns:
 
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             sql = self.get_sql(data, etid)
@@ -481,7 +485,9 @@ class EventTriggerView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index c4e0b28..a8e14a9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -216,8 +216,9 @@ class ExtensionView(PGChildNodeView):
             'name'
         ]
 
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -263,8 +264,9 @@ class ExtensionView(PGChildNodeView):
         """
         This function will update an extension object
         """
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         SQL = self.getSQL(gid, sid, data, did, eid)
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
index 8ccce61..57d3ea0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
@@ -355,7 +355,9 @@ class ForeignDataWrapperView(PGChildNodeView):
             'name'
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -422,7 +424,9 @@ class ForeignDataWrapperView(PGChildNodeView):
             did: Database ID
             fid: foreign data wrapper ID
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         sql = self.get_sql(gid, sid, data, did, fid)
         try:
             if sql and sql.strip('\n') and sql.strip(' '):
@@ -513,7 +517,9 @@ class ForeignDataWrapperView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
index 65be843..bafc323 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
@@ -356,7 +356,9 @@ class ForeignServerView(PGChildNodeView):
             'name'
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -428,7 +430,9 @@ class ForeignServerView(PGChildNodeView):
             fsid: foreign server ID
         """
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         sql = self.get_sql(gid, sid, data, did, fid, fsid)
         try:
             if sql and sql.strip('\n') and sql.strip(' '):
@@ -526,7 +530,9 @@ class ForeignServerView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
index 1f89033..4f966a9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
@@ -361,7 +361,9 @@ class UserMappingView(PGChildNodeView):
             'name'
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -435,7 +437,9 @@ class UserMappingView(PGChildNodeView):
             umid: User mapping ID
         """
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         sql = self.get_sql(gid, sid, data, did, fid, fsid, umid)
         try:
             if sql and sql.strip('\n') and sql.strip(' '):
@@ -546,7 +550,9 @@ class UserMappingView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index e1c31c4..97a0e7f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -341,7 +341,9 @@ class LanguageView(PGChildNodeView):
             did: Database ID
             lid: Language ID
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         sql = self.get_sql(data, lid)
 
         try:
@@ -389,7 +391,9 @@ class LanguageView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index 377e6f7..38c9505 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -490,9 +490,9 @@ It may have been removed by another user.
            sid: Server ID
            did: Database ID
         """
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
-
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         required_args = {
             'name': 'Name'
         }
@@ -559,7 +559,7 @@ It may have been removed by another user.
            scid: Schema ID
         """
         data = request.form if request.form else json.loads(
-            request.data.decode()
+            request.data.decode('utf-8')
         )
         try:
             SQL = self.get_sql(gid, sid, data, scid)
@@ -657,7 +657,9 @@ It may have been removed by another user.
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
index 9a9afc4..035c5cf 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
@@ -189,7 +189,7 @@ class DomainView(PGChildNodeView, DataTypeReader):
 
             data = {}
             if request.data:
-                req = json.loads(request.data.decode())
+                req = json.loads(request.data.decode('utf-8'))
             else:
                 req = request.args or request.form
 
@@ -218,12 +218,18 @@ class DomainView(PGChildNodeView, DataTypeReader):
                     if key in list_params and req[key] != '' \
                             and req[key] is not None:
                         # Coverts string into python list as expected.
-                        data[key] = json.loads(req[key])
+                        data[key] = json.loads(
+                            req[key].decode('utf-8') if hasattr(
+                                req[key], 'decode'
+                            ) else req[key]
+                        )
                     elif key == 'typnotnull':
-                        data[key] = True if req[key] == 'true' or req[key] is \
-                                                                  True else \
-                            (False if req[key] == 'false' or req[key] is
-                                                             False else '')
+                        data[key] = True if (
+                            req[key] == 'true' or req[key] is True
+                        ) else False if (
+                            req[key] == 'false' or req[key] is False
+                        ) else ''
+
                     else:
                         data[key] = req[key]
 
@@ -269,7 +275,6 @@ class DomainView(PGChildNodeView, DataTypeReader):
                 )
 
             ver = self.manager.version
-            server_type = self.manager.server_type
 
             # we will set template path for sql scripts
             if ver >= 90200:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py
index 9ae3a9b..bf24806 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py
@@ -193,7 +193,7 @@ class DomainConstraintView(PGChildNodeView):
 
             data = {}
             if request.data:
-                req = json.loads(request.data.decode())
+                req = json.loads(request.data.decode('utf-8'))
             else:
                 req = request.args or request.form
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
index 8f4af38..362055e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
@@ -232,7 +232,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
             data = {}
 
             if request.data:
-                req = json.loads(request.data.decode())
+                req = json.loads(request.data.decode('utf-8'))
             else:
                 req = request.args or request.form
 
@@ -267,7 +267,11 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
                         # Coverts string into python list as expected.
                         data[key] = [] if \
                             type(req[key]) == list and len(req[key]) == 0 else \
-                            json.loads(req[key])
+                            json.loads(
+                                req[key].decode('utf-8') if hasattr(
+                                    req[key], 'decode'
+                                ) else req[key]
+                            )
 
                         if key == 'inherits':
                             # Convert Table ids from unicode/string to int
@@ -349,7 +353,6 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
                 )
 
             ver = self.manager.version
-            server_type = self.manager.server_type
 
             # Set template path for sql scripts depending
             # on the server version.
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
index 5290129..671dbbd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
@@ -252,7 +252,7 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 
             data = {}
             if request.data:
-                req = json.loads(request.data.decode())
+                req = json.loads(request.data.decode('utf-8'))
             else:
                 req = request.args or request.form
 
@@ -280,7 +280,11 @@ class FunctionView(PGChildNodeView, DataTypeReader):
                     if key in list_params and req[key] != '' \
                             and req[key] is not None:
                         # Coverts string into python list as expected.
-                        data[key] = json.loads(req[key])
+                        data[key] = json.loads(
+                            req[key].decode('utf-8') if hasattr(
+                                req[key], 'decode'
+                            ) else req[key]
+                        )
                     elif (
                                                 key == 'proretset' or key == 'proisstrict' or
                                             key == 'prosecdef' or key == 'proiswindow' or
@@ -469,8 +473,6 @@ class FunctionView(PGChildNodeView, DataTypeReader):
         proallargtypes = data['proallargtypes'] \
             if data['proallargtypes'] else []
 
-        proargout = []
-        proargid = []
         proargmodenames = {'i': 'IN', 'o': 'OUT', 'b': 'INOUT',
                            'v': 'VARIADIC', 't': 'TABLE'}
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
index b5025a0..90e0d2a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
@@ -301,7 +301,9 @@ class SequenceView(PGChildNodeView):
             u'seqowner',
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for arg in required_args:
             if arg not in data:
@@ -417,7 +419,9 @@ class SequenceView(PGChildNodeView):
         Returns:
 
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         try:
             SQL = self.getSQL(gid, sid, did, data, scid, seid)
             SQL = SQL.strip('\n').strip(' ')
@@ -469,7 +473,9 @@ class SequenceView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index 5720f17..b225a13 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -1348,11 +1348,15 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
            did: Database ID
            scid: Schema ID
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -1381,7 +1385,10 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
         # We will convert it again to list
         if 'coll_inherits' in data and \
                 isinstance(data['coll_inherits'], str):
-            data['coll_inherits'] = json.loads(data['coll_inherits'])
+            d = data['coll_inherits']
+            data['coll_inherits'] = json.loads(
+                d.decode('utf-8') if hasattr(d, 'decode') else d
+            )
 
         if 'foreign_key' in data:
             for c in data['foreign_key']:
@@ -1434,12 +1441,14 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
            tid: Table ID
         """
         data = request.form if request.form else json.loads(
-            request.data.decode()
+            request.data.decode('utf-8')
         )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -1535,7 +1544,9 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
            tid: Table ID
         """
         # Below will decide if it's simple drop or drop with cascade call
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         # Convert str 'true' to boolean type
         is_cascade = json.loads(data['cascade'])
 
@@ -1581,7 +1592,9 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
            tid: Table ID
         """
         # Below will decide if it's simple drop or drop with cascade call
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         # Convert str 'true' to boolean type
         is_enable = json.loads(data['enable'])
 
@@ -1663,7 +1676,9 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
index c60bbfb..f0094cb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
@@ -505,12 +505,14 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
            tid: Table ID
         """
         data = request.form if request.form else json.loads(
-            request.data.decode()
+            request.data.decode('utf-8')
         )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -631,7 +633,9 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
            tid: Table ID
            clid: Column ID
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         # Adding parent into data dict, will be using it while creating sql
         data['schema'] = self.schema
@@ -688,7 +692,9 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
index 32ccf23..ad23cc2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
@@ -396,11 +396,15 @@ class CheckConstraintView(PGChildNodeView):
         """
         required_args = ['consrc']
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -545,7 +549,9 @@ class CheckConstraintView(PGChildNodeView):
             tid: Table Id
             cid: Check Constraint Id
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             data['schema'] = self.schema
@@ -661,7 +667,9 @@ class CheckConstraintView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
index 686f0b8..0f02422 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
@@ -441,11 +441,15 @@ class ExclusionConstraintView(PGChildNodeView):
         """
         required_args = ['columns']
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'deocde') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -546,7 +550,9 @@ class ExclusionConstraintView(PGChildNodeView):
         Returns:
 
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             data['schema'] = self.schema
@@ -666,7 +672,9 @@ class ExclusionConstraintView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
index 75fd0b9..a6e1a73 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
@@ -464,11 +464,15 @@ class ForeignKeyConstraintView(PGChildNodeView):
         """
         required_args = ['columns']
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -598,7 +602,9 @@ class ForeignKeyConstraintView(PGChildNodeView):
         Returns:
 
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             data['schema'] = self.schema
@@ -726,7 +732,9 @@ class ForeignKeyConstraintView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
@@ -1044,7 +1052,10 @@ class ForeignKeyConstraintView(PGChildNodeView):
         index = None
         try:
             if data and 'cols' in data:
-                cols = set(json.loads(data['cols']))
+                cols = data['cols']
+                cols = set(json.loads(
+                    cols.decode('utf-8') if hasattr(cols, 'decode') else cols
+                ))
                 index = self.search_coveringindex(tid, cols)
 
             return make_json_response(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
index 8854de2..e68d7ec 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
@@ -444,11 +444,15 @@ class IndexConstraintView(PGChildNodeView):
             [u'columns', u'index']  # Either of one should be there.
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -563,7 +567,9 @@ class IndexConstraintView(PGChildNodeView):
         Returns:
 
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             data['schema'] = self.schema
@@ -688,7 +694,9 @@ class IndexConstraintView(PGChildNodeView):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
index 665d4ae..6ada3cd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
@@ -440,7 +440,6 @@ class IndexesView(PGChildNodeView):
         # 'options' we need true/false to render switch ASC(false)/DESC(true)
         columns = []
         cols = []
-        cnt = 1
         for row in rset['rows']:
             # We need all data as collection for ColumnsModel
             cols_data = {
@@ -522,12 +521,14 @@ class IndexesView(PGChildNodeView):
            tid: Table ID
         """
         data = request.form if request.form else json.loads(
-            request.data.decode()
+            request.data.decode('utf-8')
         )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -672,7 +673,9 @@ class IndexesView(PGChildNodeView):
            tid: Table ID
            idx: Index ID
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         data['schema'] = self.schema
         data['table'] = self.table
         try:
@@ -721,7 +724,9 @@ class IndexesView(PGChildNodeView):
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py
index 1b045ec..10290fd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py
@@ -290,8 +290,9 @@ class RuleView(PGChildNodeView):
             'name',
         ]
 
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -331,8 +332,9 @@ class RuleView(PGChildNodeView):
         """
         This function will update a rule object
         """
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         SQL = self.getSQL(gid, sid, data, tid, rid)
         try:
             if SQL and SQL.strip('\n') and SQL.strip(' '):
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
index acffc96..d2492fb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
@@ -537,12 +537,14 @@ class TriggerView(PGChildNodeView):
            tid: Table ID
         """
         data = request.form if request.form else json.loads(
-            request.data.decode()
+            request.data.decode('utf-8')
         )
 
         for k, v in data.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except (ValueError, TypeError):
                 data[k] = v
 
@@ -657,7 +659,9 @@ class TriggerView(PGChildNodeView):
            tid: Table ID
            trid: Trigger ID
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             SQL = self.get_sql(scid, tid, trid, data)
@@ -705,7 +709,9 @@ class TriggerView(PGChildNodeView):
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
@@ -847,7 +853,9 @@ class TriggerView(PGChildNodeView):
            trid: Trigger ID
         """
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         # Convert str 'true' to boolean type
         is_enable_flag = json.loads(data['enable'])
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 769ebb2..3520999 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -783,7 +783,9 @@ class TypeView(PGChildNodeView, DataTypeReader):
            scid: Schema ID
            tid: Type ID
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         required_args = {
             'name': 'Name',
             'typtype': 'Type'
@@ -888,7 +890,9 @@ class TypeView(PGChildNodeView, DataTypeReader):
            tid: Type ID
         """
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         try:
             SQL = self.get_sql(gid, sid, data, scid, tid)
             if SQL and SQL.strip('\n') and SQL.strip(' '):
@@ -994,7 +998,9 @@ class TypeView(PGChildNodeView, DataTypeReader):
         # converting nested request data in proper json format
         for key, val in req.items():
             if key in ['composite', 'enum', 'seclabels', 'typacl']:
-                data[key] = json.loads(val)
+                data[key] = json.loads(
+                    val.decode('utf-8') if hasattr(val, 'decode') else val
+                )
             else:
                 data[key] = val
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 741423f..f0b7b91 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -466,8 +466,9 @@ class ViewNode(PGChildNodeView, VacuumSettings):
             'definition'
         ]
 
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -511,8 +512,9 @@ class ViewNode(PGChildNodeView, VacuumSettings):
         """
         This function will update a view object
         """
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         SQL = self.getSQL(gid, sid, data, vid)
         try:
             if SQL and SQL.strip('\n') and SQL.strip(' '):
@@ -626,7 +628,9 @@ class ViewNode(PGChildNodeView, VacuumSettings):
         data = {}
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
@@ -1591,8 +1595,9 @@ class MViewNode(ViewNode, VacuumSettings):
         """
 
         # Below will decide if it's refresh data or refresh concurrently
-        data = request.form if request.form else \
-            json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         is_concurrent = json.loads(data['concurrent'])
         with_data = json.loads(data['with_data'])
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
index 894c3c5..68d74d3 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
@@ -312,7 +312,9 @@ class ResourceGroupView(NodeView):
             'name'
         ]
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
         for arg in required_args:
             if arg not in data:
                 return make_json_response(
@@ -370,7 +372,9 @@ class ResourceGroupView(NodeView):
         required_args = [
             'name', 'cpu_rate_limit', 'dirty_rate_limit'
         ]
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             sql = render_template("/".join([self.template_path, 'properties.sql']), rgid=rg_id)
@@ -462,7 +466,9 @@ class ResourceGroupView(NodeView):
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'decode') else v
+                )
             except ValueError:
                 data[k] = v
 
diff --git a/web/pgadmin/browser/server_groups/servers/roles/__init__.py b/web/pgadmin/browser/server_groups/servers/roles/__init__.py
index ddb55b9..891c9b3 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/roles/__init__.py
@@ -111,7 +111,10 @@ class RoleView(PGChildNodeView):
 
             data = None
             if request.data:
-                data = json.loads(request.data)
+                data = request.data
+                data = json.loads(
+                    data.decode('utf-8') if hasattr(data, 'decode') else data
+                )
             else:
                 data = dict()
                 req = request.args or request.form
@@ -125,7 +128,9 @@ class RoleView(PGChildNodeView):
                         u'rolcatupdate', u'variables', u'rolmembership',
                         u'seclabels'
                     ]:
-                        data[key] = json.loads(val)
+                        data[key] = json.loads(
+                            val.decode('utf-8') if hasattr(val, 'decode') else val
+                        )
                     else:
                         data[key] = val
 
@@ -146,7 +151,7 @@ class RoleView(PGChildNodeView):
                             data[u'rolvaliduntil'], '%m/%d/%Y'
                         )
                         data[u'rolvaliduntil'] = date.strftime("%d-%B-%Y")
-                except Exception as e:
+                except Exception:
                     return precondition_required(
                         _("Date format is invalid.")
                     )
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index b853def..8b65379 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -252,7 +252,9 @@ class TablespaceView(PGChildNodeView):
             'spclocation': 'Location'
         }
 
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         for arg in required_args:
             if arg not in data:
@@ -318,7 +320,9 @@ class TablespaceView(PGChildNodeView):
         """
         This function will update tablespace object
         """
-        data = request.form if request.form else json.loads(request.data.decode())
+        data = request.form if request.form else json.loads(
+            request.data.decode('utf-8')
+        )
 
         try:
             SQL = self.get_sql(gid, sid, data, tsid)
@@ -405,7 +409,9 @@ class TablespaceView(PGChildNodeView):
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'utf-8') else v
+                )
             except ValueError as ve:
                 current_app.logger.exception(ve)
                 data[k] = v
@@ -723,7 +729,10 @@ class TablespaceView(PGChildNodeView):
             sid: Server ID
             tsid: Tablespace ID
         """
-        data = json.loads(request.form['data'])
+        data = request.form['data']
+        data = json.loads(
+            data.decode('utf-8') if hasattr(data, 'decode') else data
+        )
 
         try:
             SQL = render_template("/".join(
@@ -762,7 +771,9 @@ class TablespaceView(PGChildNodeView):
         data = dict()
         for k, v in request.args.items():
             try:
-                data[k] = json.loads(v)
+                data[k] = json.loads(
+                    v.decode('utf-8') if hasattr(v, 'utf-8') else v
+                )
             except ValueError as ve:
                 current_app.logger.exception(ve)
                 data[k] = v
