Hello Django core team,
I would like to propose adding native support for returning form validation errors in a structured JSON format directly from Django’s form handling views.
Currently, form errors are primarily rendered as HTML or simple text, which complicates integration with modern frontend frameworks and APIs that expect JSON responses.
This feature would enable:
- Seamless JSON error responses from form views (e.g., via an optional flag or method override).
- Detailed error information including error codes and messages.
- Backward compatibility with existing HTML-based form handling.
Implementing this enhancement would greatly improve Django’s usability in SPA and API-driven applications, reduce boilerplate code, and standardize error handling across projects.
I look forward to your feedback and am eager to contribute this feature to Django core.
Thank you for your consideration!