简体   繁体   English

当我们调用 API 时如何停止忽略 jObject 属性?

[英]how to stop ignoring jObject properties when we call API?

I'm calling API using postman, I'm sending dynamic properties using JObject as given below我正在使用邮递员调用 API,我正在使用 JObject 发送动态属性,如下所示

I'm sending class data to API using JSON but which is ignoring the values of duplicate data我正在使用 JSON 向 API 发送类数据,但它忽略了重复数据的值

     public class Details
        { 
            public List<JObject> Mappings { get; set; } 

             // adding properties to jobject abd mappings     

            [JsonExtensionData]
            public IDictionary<string, JToken> AdditionalProperties { get; set; }

         }

I'm using below JSON in postman我在邮递员中使用以下 JSON

    {      
      "source": {
            "details": "Sample Customer",
            "compoet": "Sample Site",
            "Name": "Sample Software",
            "Version": "1.0.1",
            "Creator": "Sample Company"
        },
      "Mappings":[
      {
        "data": Test.Name1",
        "data": Test.Name23",    
        "newprop":"Account1",
      }
    {
        "data": "Test.Name2",    
        "newprop":"Account2",
      }
    ]
    }

when I pass duplicate key API is taking second value "data": Test.Name23" I want API should take both values from mapping can anyone help?当我传递重复键 API 时采用第二个值"data": Test.Name23"我希望 API 应该从映射中获取两个值有人可以帮忙吗?

it's better don't do that, and this is my reason最好不要那样做,这就是我的理由

you can pass "data" value as an array您可以将“数据”值作为数组传递

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM