Files
open-webui/backend/open_webui/utils
Classic298 72fdf238a8 perf: optional orjson JSON codec behind ENABLE_ORJSON (#27583)
Swap the JSON encoder/decoder used across the backend from stdlib json to
orjson when ENABLE_ORJSON is set — HTTP request bodies, JSONResponse
bodies, upstream provider responses, SSE chunks, and socket.io/Redis
payloads.

The flag defaults to off, in which case the app uses stdlib json and
engineio's codec verbatim, so default behaviour is unchanged.

- json_codec exports JSONCodec (stdlib json or the orjson codec) and
  SOCKETIO_JSON (engineio's codec or the orjson codec); call sites import
  JSONCodec and stay implementation-agnostic
- apply_orjson_http_json() is a no-op when the flag is off, leaving
  starlette's Request.json / JSONResponse.render untouched
- the orjson codec falls back to the stdlib for inputs orjson rejects
  (non-str dict keys, ints beyond 64 bits, NaN literals)
- orjson is imported only when the flag is on
- FastAPI(default_response_class=...) is deliberately not used: an
  explicit default disables the Pydantic direct-to-bytes fast path for
  response_model routes
2026-07-27 03:45:37 -04:00
..
2026-07-01 02:48:29 -05:00
2026-06-29 11:56:00 -05:00
2026-07-27 03:01:19 -04:00
2026-07-23 22:52:23 -04:00
2026-07-27 00:12:47 -04:00
2026-03-17 17:58:01 -05:00
2026-07-23 02:54:56 -04:00
2026-07-26 21:12:14 -04:00
2026-07-24 01:44:30 -04:00
2026-07-27 02:34:04 -04:00
2026-07-27 03:05:26 -04:00
2026-07-23 21:29:33 -04:00
2026-07-27 02:36:15 -04:00
2026-07-27 00:12:47 -04:00
2026-07-27 02:24:41 -04:00
2026-07-27 02:39:11 -04:00
2026-07-27 02:49:08 -04:00
2026-07-26 23:09:22 -04:00
2026-07-16 01:37:21 -04:00
2026-07-27 02:28:21 -04:00
2026-07-23 19:17:19 -04:00
2026-03-17 17:58:01 -05:00
2026-07-20 22:11:42 -04:00
2026-06-19 00:16:06 +02:00
2026-07-10 18:32:21 -05:00
2026-07-27 03:41:08 -04:00
2026-06-01 13:56:55 -07:00
2026-06-29 12:29:10 -05:00
2026-07-26 17:58:01 -04:00