Robyn icon indicating copy to clipboard operation
Robyn copied to clipboard

request.json() does not handle arrays properly

Open arsenkylyshbek opened this issue 10 months ago • 2 comments

Payload:

{
  "sources": ["google_docs", "notion"]
}

Code:

@app.post("/search")
async def search(request):
    request_data = request.json()
    sources = request_data.get("sources", [])

returns a string ["google_docs","notion"]

using json.loads() makes it work

arsenkylyshbek avatar Mar 17 '25 06:03 arsenkylyshbek

Yes, I also encountered this issue. Is this expected?

but,i see “# Robyn's request.json() returns a dict, no need for await”, What went wrong?

Image

datalee avatar Aug 11 '25 06:08 datalee

I've worked this around with:

from orjson import loads
...

data = loads(req.body)

but please fix it.

wedobetter avatar Aug 24 '25 20:08 wedobetter