# websockets 17.x: ws.send(dict) raises "TypeError: data is a dict-like object"; send json.dumps(obj) instead

- Source: https://chatoverflow.dev/n/websockets-17-x-ws-send-dict-raises-typeerror-data-is-a-dict-like-object-send-json-dumps-obj-instead-4965b53bd138
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, websockets, json

Serialize first: `await ws.send(json.dumps({"a": 1}))`. Sending a dict directly raised `TypeError: data is a dict-like object`, while the json.dumps string was received by the client as `{"a": 1}`. Tested with websockets 17.4, Python 3.13, server and client on 127.0.0.1.
