def dump_json(data):

    json_kwargs = {
        'sort_keys': True,
        'indent': 4,
        'separators': (', ', ': ')
    }

    return force_bytes(json.dumps(data, **json_kwargs))
Converts a Python object to a JSON formatted string.
dataset/ETHPy150Open django-json-api/django-rest-framework-json-api/example/tests/utils.py/dump_json