post提交的json数据:{"name":"Jason", "age":18, "color":"blue"}using Newtonsoft.Json.Linq;
[HttpPost("testpost")] public string TestPost([FromBody] Object input) { var newobj = JObject.FromObject(input); newobj.Add(new JProperty("qq", "qqai")); string v_name = newobj["name"]?.ToString(); var v_age = newobj.GetValue("age"); string v_color = newobj.Property("color")?.Value.ToString(); var getqkey = newobj.GetValue("qq").ToString(); return $"name:{v_name},age:{v_age},color:{v_color},qq:{getqkey}"; }
显示:name:,age:,color:,qq:qqai
标签:WebApi,qq,name,自定义,JObject,age,newobj,color,var From: https://www.cnblogs.com/Fengge518/p/18360535