FastAPI: how to read body as any valid json?
问题 Sorry, not proficient in Python. I haven't found the docs for that use case. How can I get the request body, ensure its a valid Json ( any valid json , including numbers, string, booleans and nulls, not only objects and arrays) and get the actual Json. Using pydantic forces the Json to have a specific structure. 回答1: You can find nearly everything inside the Request object You are able to get request body with request.body() from fastapi import Request, FastAPI @app.post("/dummypath") async