diff --git a/api_server.py b/api_server.py index 2c93cf8..87f5bc8 100644 --- a/api_server.py +++ b/api_server.py @@ -650,7 +650,11 @@ async def get_raw_post_json(channel: str, post_id: int, token: str | None = None if not message: raise HTTPException(status_code=404, detail="Post not found") - return JSONResponse(content=message, media_type="application/json") + # Return message as JSON using json.dumps with default=str to handle non-serializable objects + return Response( + content=json.dumps(message, indent=2, ensure_ascii=False, default=str), + media_type="application/json" + ) except Exception as e: error_message = f"Failed to get raw JSON post for channel {channel}, post_id {post_id}: {str(e)}" logger.error(error_message)