Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

819
Views
How to post dictionary data type in FastAPI Request Forms ? Error : "msg": "value is not a valid dict", "type": "type_error.dict"

My POST using FastAPI Request Form:

Request Body | application/x-www-form-urlencoded

I am trying to post,

  1. "list" of "dict" using request form - error Code:422
  2. Only "dict" using request form - error Code:422
  3. without "dict" - Its Worked
@menu.post("/add-menu")
async def addmenu(
    ItemName: str = Form(...),
    ItemShortDesc: str = Form(...),
    ItemPrice: str = Form(...),
    ItemCategory: list = Form(...),
    ItemStatus: str = Form(...),
    ItemChoices: list[dict[str,str]] = Form(...)):
    
    return ItemChoices

FastAPI Swagger Screenshot

I got below error

Code 422 | Error: Unprocessable Entity

  "detail": [
    {
      "loc": [
        "body",
        "ItemChoices",
        0
      ],
      "msg": "value is not a valid dict",
      "type": "type_error.dict"
    }
  ]
}

How can I use "dict" or "list" of "dict" in FastAPI request form? Please help me out of any possible chance.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!