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

Consider adding axum::json! #2937

Open
carllerche opened this issue Sep 24, 2024 · 0 comments
Open

Consider adding axum::json! #2937

carllerche opened this issue Sep 24, 2024 · 0 comments
Assignees

Comments

@carllerche
Copy link
Member

Feature Request

Consider adding an axum::json! macro that matches the serde_json macro syntax and avoids the stutter:

async fn hello_world() -> impl IntoResponse {
    axum::json!({ "hello": "world" })
}

Motivation

Returning JSON is common. This would avoid adding an extra dependency in the end user's Cargo.toml and avoid some stutter (Json(json!(...))) without exposing the serde_json dependency.

@jplatte jplatte self-assigned this Sep 28, 2024
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