Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for alternative json parsers #1255

Closed
thedrow opened this issue Dec 1, 2013 · 5 comments
Closed

Add support for alternative json parsers #1255

thedrow opened this issue Dec 1, 2013 · 5 comments

Comments

@thedrow
Copy link
Contributor

thedrow commented Dec 1, 2013

ultrajson is a good example of a faster JSON implementation that one might want to use.
Should I create a pull request that attempts to import ultrajson as json and if it's not available import json?

@tomchristie
Copy link
Member

Someone's already on it. See: http://django-rest-framework.org/api-guide/renderers#ultrajson

I guess they might also accept a PR to add a parser to the drf-ujson-renderer package as well as the existing renderer.

@thedrow
Copy link
Contributor Author

thedrow commented Dec 2, 2013

Why isn't this a core feature? JSON is the most common renderer, and DRF spends a non-neglectable amount of time parsing and rendering JSON.
In any production system if I can do a drop-in replacement and have better performance I would do so.
I suggest simply importing ujson as json in the compat module if it's available.

@tomchristie
Copy link
Member

I doubt it's that simple - does ujson support custom encoders?... https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/utils/encoders.py#L15

@thedrow
Copy link
Contributor Author

thedrow commented Dec 2, 2013

I can check and come back to you later. In the meanwhile, please don't close issues before they are actually closed.

@thedrow
Copy link
Contributor Author

thedrow commented Dec 2, 2013

So this is currently blocked by ultrajson/ultrajson#124. I'll keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants