Я пытаюсь получить следующий JSON:
{
"va": "{1: 5, 2:1, 3:5}"
}
в моем main.py у меня есть следующее:
from typing import Optional, Dict
from fastapi import FastAPI
from pydantic import BaseModel
class rq(BaseModel):
va: Dict[str, str]
app = FastAPI(debug=True)
@app.post("/hello")
async def create_item(rq: rq):
return 1
но я получаю
msg: значение не является допустимым dict, введите: type_error.dict
как я могу получить va as dict, чтобы перебрать его?