Drf_ujson2

JSON parser and renderer using ujson for Django Rest Framework
Alternatives To Drf_ujson2
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Python 100 Days135,076
a month ago682Python
Python - 100天从新手到大师
Django Rest Framework25,64724,5951,508a day ago134December 15, 2021132otherPython
Web APIs for Django. 🎸
Awesome Django7,045
2 days ago2cc0-1.0HTML
A curated list of awesome things related to Django
Drf Yasg3,0922907616 days ago59October 25, 2020235otherPython
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
Django Rest Swagger2,5162,031413 years ago50April 30, 2018168bsd-2-clausePython
Swagger Documentation Generator for Django REST Framework: deprecated
Django Rest Auth2,3311,1092410 months ago25April 01, 2019234mitPython
This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
Djoser2,28821257 days ago48October 30, 2020166mitPython
REST implementation of Django authentication system.
Drf Nested Routers1,487621299 days ago19October 15, 202146apache-2.0Python
Nested Routers for Django Rest Framework
Cookiecutter Django Rest1,406
2 days ago4mitPython
Build best practiced apis fast with Python3
Drf Extensions1,371323145 days ago16July 30, 202175mitPython
DRF-extensions is a collection of custom extensions for Django REST Framework
Alternatives To Drf_ujson2
Select To Compare


Alternative Project Comparisons
Readme

Django Rest Framework UJSON Renderer

PyPi - Version PyPI - Python Version PyPI - Django Version PyPI - Downloads Code style: Black

Django Rest Framework renderer using ujson

Installation

pip install drf_ujson2

You can then set the UJSONRenderer class as your default renderer in your settings.py

REST_FRAMEWORK = {
    'DEFAULT_RENDERER_CLASSES': (
        'drf_ujson.renderers.UJSONRenderer',
    ),
    ...
}

Benchmarks

This is on average 2.3x faster than the default JSON Serializer.

import timeit

setup = '''
from proposals.models import Proposal
from proposals.serializers import ProposalSerializer
from rest_framework.renderers import JSONRenderer
from drf_ujson.renderers import UJSONRenderer

proposals = Proposal.objects.all()
serialized = ProposalSerializer(proposals, many=True).data
'''

stdlib_test = '''
JSONRenderer().render(serialized)
'''

ujson_test = '''
UJSONRenderer().render(serialized)
'''

stdlib_result = timeit.repeat(stdlib_test, setup=setup, number=1, repeat=10)
ujson_result = timeit.repeat(ujson_test, setup=setup, number=1, repeat=10)

print stdlib_result
print sum(stdlib_result) / 10
print ujson_result
print sum(ujson_result) / 10

# stdlib results
[
0.004502058029174805,
0.004289865493774414,
0.006896018981933594,
0.0048198699951171875,
0.004084110260009766,
0.007154941558837891,
0.003937959671020508,
0.004029035568237305,
0.004770040512084961,
0.004539966583251953
]
# avg
0.00490238666534

# ujson results
[
0.0016620159149169922,
0.001817941665649414,
0.0015261173248291016,
0.0040950775146484375,
0.0021469593048095703,
0.001798868179321289,
0.001569986343383789,
0.0019931793212890625,
0.0017120838165283203,
0.001814126968383789
]
# avg
0.00201363563538
Popular Rest Projects
Popular Django Projects
Popular Application Programming Interfaces Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Python
Json
Django
Rest
Renderer
Django Rest Framework
Json Parser