c# 创建JSON数据并转为字符串

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
你的function...{
	// 创建json 对象
	JObject msg = new JObject ();
	// 设置json对象
	msg["msgType"]=msgType;
	msg["message"] = message;
	// 转为json字符串
	string resultMsg = JsonConvert.SerializeObject(msg);
}

猜你喜欢

转载自blog.csdn.net/sunfellow2009/article/details/84954334
今日推荐