How to use the ujson.JSONEncoder.encode function in ujson

To help you get started, we’ve selected a few ujson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / indy-plenum / ledger / serializers / json_serializer.py View on Github external
def encode(self, o):
            if isinstance(o, (bytes, bytearray)):
                return '"{}"'.format(base64.b64encode(o).decode("utf-8"))
            else:
                return json.JSONEncoder.encode(self, o)