【Web API】如何传入子模型节点?并在控制器能获取到 —— 》 某个属性是List

2020-05-15 17:38发布

问题:

{"pid": 114,"name": "KTY81/8886","parentcate": "時科SHIKUES","desc": "温度传感器","num": 5,"img": "/static/images/img-sksp-sp@2x.png","nowprice": 0.49},{"pid": 114,"name": "KTY81/8886","parentcate": "時科SHIKUES","desc": "温度传感器","num": 5,"img": "/static/images/img-sksp-sp@2x.png","nowprice": 0.49}]![](https://img2018.cnblogs.com/q/912080/201908/912080-20190828112544610-851101764.png)

后台模型:

 

发现这样传入,并不能接收到值求大佬指点

 

回答1:

如果你使用的是默认的参数绑定,FromBody必须是这样传:



标签: webapi