# JSON Extractor
When building APIs, receiving JSON data is a primary requirement. Actix Web uses the web::Json extractor to seamlessly parse incoming JSON payloads into Rust structs.
#Basic Extraction
Simply define a struct that implements Deserialize, and wrap it in web::Json in your handler arguments.
code_blocksrust
use actix_web::{post, web, HttpResponse};
use serde::Deserialize;
#[derive(Deserialize)]
struct CreateUser {
username: String,
email: String,
}
#[post("/users")]
async fn create_user(info: web::Json<CreateUser>) -> HttpResponse {
HttpResponse::Ok().body(format!("Welcome {}!", info.username))
}#Payload Configuration
By default, the JSON extractor limits the payload size to prevent Denial of Service (DoS) attacks. You can adjust this limit and customize the error response.
code_blocksrust
use actix_web::{web, App};
App::new().app_data(web::JsonConfig::default().limit(4096))