1
我想给在C#中的POST请求,我需要以下通过C#POST请求被发送
"jsonrpc": "2.0",
"id": "12345",
"method": "my method",
"params": {
"api_key": "my api key",
"preset_id": "my preset id"
}
我尝试使用
using (WebClient client = new WebClient())
{
byte [] response =
client.UploadValues ("my url", new NameValueCollection()
{
{ "jsonrpc", "2.0" },
{ "id", "12345"},
{ "method", "my method"},
{ "params", ""}
});
string result = System.Text.Encoding.UTF8.GetString (response);
}
发送,但我不能让PARAMS的array,请大家帮忙,谢谢
可能的重复[在C#中通过WebClient发布JSON到URL](http://stackoverflow.com/questions/15091300/posting-json-to-url-via-webclient-in-c-sharp) – CodingYoshi
@CodingYoshi不完全,我的问题来自事实,我可以有参数是一个数组。你发布的解决方案也不使用数组。感谢您的尝试 –