C# Azure 函数嵌套 JSON 数据 POST

C# Azure Function Nested JSON data POST

我想要 POST 一个 JSON 如下所示的数据:

{
 "RequestID": "Req000002",
 "fullfillmenttFactor": 65,
 "ifFlexRequested": "True",
 "isBlind": "True",
 "loc": {
  "user001": 4,
  "user002": 7
 },
 "marketType": "fixedPrice",
 "maxPriceCtpEU": "null"
}

现在对于其他数据,我可以这样做:

[BsonElement ("RequestId"), JsonProperty(Required=Required.Always)] 
        public string RequestID { get; set; }

        [BsonElement("FullfillmentFactor"), JsonProperty(Required = Required.Always)]
        public int FullfillmentFactor { get; set; }

        [BsonElement("IfFlexRequested"), JsonProperty(Required = Required.Always)]
        public bool IfFlexRequested { get; set; }

但是如何处理 Loc 数据?

我可以这样做:

public class LocationInfo: Document{
[BsonElement("LocInfo"), JsonProperty(Required = Required.Always)]
public int LocInfo { get; set; }
...
}

然后在 Loc:

[BsonElement("Loc"), JsonProperty(Required = Required.Always)]
public LocationInfo FullfillmentFactor { get; set; }

但在这里我如何传递多个值,如下所示:

"loc": {
  "user001": 4,
  "user002": 7
 }

您可以将 loc 定义为字典

public Dictionary<string,int> loc { get; set; }