QJsonObject::size() does not return the size of the encoded QJsonDocument object. Leave that header out entirely: QNetworkAccessManager::post() will set it for you.