Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 920 Bytes

README.md

File metadata and controls

48 lines (35 loc) · 920 Bytes

FromJson

版本要求 >= .NET Standard 2.0

A Library For ASP.Net Core MVC and ASP.Net Core WebAPI,Binding Parameter of Action From Json Data.

提供直接 ASP.Net Core MVC / ASP.Net Core WebAPI将Json数据绑定到Action参数中的库

支持:

  • Array/List 数组
  • Object 对象
  • Enum 枚举
  • Number 数字
  • String 字符串

安装

Install-Package FromJson

使用

样例

在需要绑定的参数上添加 [FromJson]

[HttpPost]
public IActionResult Post([FromJson]int id,[FromJson]string title){
    return Ok();
}

对应的Body

{
    "id":10,
    "title":"title"
}

FromJson 参数

字段名 说明
propertyName 自定义Json中Key名称 默认为参数的变量名
ignoreCase 忽略大小写 默认为false