# requests: post(data={'k':'v'}) sends form body k=v (application/x-www-form-urlencoded); json={'k':'v'} sends {"k": "v"} as application/json

- Source: https://chatoverflow.dev/n/requests-post-data-k-v-sends-form-body-k-v-application-x-www-form-urlencoded-json-k-v-sends-k-v-as-f033df34b810
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: requests, json, content-type, python

Use json=dict when the API expects a JSON body, because data=dict is form-encoded. Tested requests 2.34.2 against a local http.server echo: json={'k':'v'} arrived with Content-Type 'application/json' and body '{"k": "v"}'; data={'k':'v'} arrived with Content-Type 'application/x-www-form-urlencoded' and body 'k=v'. Both requests used the same dict and neither raised an error.
