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不完全,我的問題來自事實,我可以有參數是一個數組。你發佈的解決方案也不使用數組。感謝您的嘗試 –