djangorestframework-camel-case

Camel case JSON support for Django REST Framework APIs.

Library
PyPI
v1.4.2
674stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
46/100Fair
Development Activity36
Maintenance0
Community68
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture78
Code Quality74
Innovation68
Learning Curve90

djangorestframework-camel-case bridges Python’s snake_case conventions with the camelCase that JavaScript clients expect. It provides drop-in renderers and parsers for Django REST Framework that automatically convert outgoing response keys to camelCase and incoming request keys back to snake_case.

By registering its renderer, parser, and optional query-parameter middleware in your DRF settings, your serializers keep writing idiomatic Python field names while your API speaks the camelCase dialect front-end frameworks prefer, with no per-field mapping required.

What You Get

  • CamelCaseJSONRenderer and browsable-API renderer that emit camelCase JSON
  • Parser classes for JSON, form, and multipart requests that accept camelCase input
  • Middleware to convert camelCase query parameters to snake_case
  • Configurable underscore/camelCase conversion behavior via settings
  • Zero per-field mapping - conversion is applied automatically across all keys

Common Use Cases

  • Serving a camelCase JSON API to a React, Vue, or Angular front end from Django
  • Keeping Python serializers snake_case while clients consume camelCase
  • Accepting camelCase request payloads without renaming serializer fields
  • Normalizing camelCase query-string parameters into snake_case for filtering

Under The Hood

Architecture - The library is a small Django app (djangorestframework_camel_case/) composed of focused modules: render.py (camelCase renderers), parser.py (camelCase-aware parsers), middleware.py (query-param conversion), util.py (the recursive camelize/underscoreize transforms), and settings.py for configuration. Renderers and parsers subclass DRF’s built-ins and apply the key-transform functions to serialized data on the way out and parsed data on the way in.

Tech Stack - Pure Python built directly on Django REST Framework, packaged with setuptools via pyproject.toml/setup.py, with tox for multi-environment testing. It has no heavy runtime dependencies beyond DRF itself.

Code Quality - The codebase is compact and single-purpose, with a tests.py suite exercising the renderers, parsers, and conversion utilities. Recent maintenance has been infrequent, but the surface is small and stable, and the recursive conversion logic is centralized in util.py.

API Design - Developer experience is excellent for its scope: you add renderer, parser, and middleware class paths to your DRF/Django settings and everything else is automatic. There is no per-field configuration to write, and behavior can be tuned through a small settings dictionary when defaults do not fit.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search