diff --git a/scribe/hub/jsonrpc.py b/scribe/hub/jsonrpc.py index cf9f0c4..a92c0ec 100644 --- a/scribe/hub/jsonrpc.py +++ b/scribe/hub/jsonrpc.py @@ -1,5 +1,6 @@ import itertools import json +import ujson import typing import asyncio from asyncio import Event @@ -186,7 +187,7 @@ class JSONRPC: def encode_payload(cls, payload): """Encode a Python object as JSON and convert it to bytes.""" try: - return json.dumps(payload).encode() + return ujson.dumps(payload).encode() except TypeError: msg = f'JSON payload encoding error: {payload}' raise ProtocolError(cls.INTERNAL_ERROR, msg) from None diff --git a/setup.py b/setup.py index 438b203..737fcbb 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,8 @@ setup( 'hachoir==3.1.2', 'filetype==1.0.9', 'grpcio==1.38.0', - 'lbry-rocksdb==0.8.2' + 'lbry-rocksdb==0.8.2', + 'ujson==5.1.0' ], extras_require={ 'lint': ['pylint==2.10.0'],