Skip to content

TiPod/FromJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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