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

Allow use of ORJSONParser #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PaarthShah
Copy link

Fixes #144

Tested manually by setting the orjson render/parser as the default in settings.py: not sure if there's another way to be doing that/including it in the tests

@PaarthShah
Copy link
Author

@vbabiy Any objections to this?

@piraka9011
Copy link

piraka9011 commented Nov 10, 2024

FWIW this library doesn't seem maintained, but in case someone comes across this PR/issue in the future, this PR is a step in the right direction but, CamelCaseJSONParser.parse also needs to be updated to:

def parse(self, stream, media_type=None, parser_context=None):
    try:
        data = super().parse(stream, media_type, parser_context)
        return underscoreize(data, **self.json_underscoreize)
    except ValueError as exc:
        raise ParseError("JSON parse error - %s" % str(exc))

Otherwise, as you'll notice in the current implementation, it always uses json.loads which negates the whole point behind improving the performance of deserialization.

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

Successfully merging this pull request may close these issues.

Allow the use of orjson parser
2 participants