I am creating a JSON object in code. But the JSON contains property params
, so when I try to create object like this:
using Newtonsoft.Json.Linq;
JObject json = JObject.FromObject(new
{
jsonrpc = "2.0",
method = "user.login",
params = new
{
user = "user",
password = "password"
},
id = 1
});
I get an error because VS thinks its params
the keyword. Is there way how to create object like this or somehow use params
without using params
?
使用@params,以便可以转义特殊关键字
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.