I have a class

public class ItemList
{
    public long Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public List<int> ItemModList { get; set; }
}

how should i give the input JSON for list of int as it does not have a key to match its value

JSON

{
    "Id": "610",
    "Name": "15",
    "Description": "1.99",
    "ItemModList": []
}

我应该在ItemModList中写什么

推荐答案

假设您的整数为0、375、668、5和6:

{
    "Id": "610",
    "Name": "15",
    "Description": "1.99",
    "ItemModList": [
                       0,
                       375,
                       668,
                       5,
                       6
                   ]
}

I suggest that you change "Id": "610" to "Id": 610 since it is a integer/long and not a string. You can read more about the JSON format and examples here http://json.org/

Json相关问答推荐

JOLT拉平数组

从Postgres表中的JSON中提取值

JOLT转换以根据条件删除json对象

将不带正文的 CURL POST 转换为 RESTRequest Delphi 代码 / 为 Dropbox API /get_current_account 端点编写 Delphi 代码

使用 jq,如何将两个属性构成键的对象数组转换为对象的索引对象?

使用 Groovy 将 XML 转换为 JSON

NiFi 使用嵌套数组将 avro 转换为 JSON 数组格式

Rails 控制器无需编码即可渲染 json

如何限制resolveJsonModule的范围?

JSON RPC - 什么是id?

如何从 mysql 数据库构建 JSON 数组

在 JSON API Wordpress 上启用 CORS

如何获取json格式的KendoGrid显示数据?

Spring MVC控制器中的JSON参数

JSON.stringify 不会转义?

Spring Security 和 JSON 身份验证

如何将 Swift 对象转换为字典

与classic 规范化表相比,postgres JSON 索引是否足够高效?

Jackson JSON序列化,通过级别定义避免递归

jq:按属性分组和键