I want to POST
a JSON
data which looks like this:
{
"RequestID": "Req000002",
"fullfillmenttFactor": 65,
"ifFlexRequested": "True",
"isBlind": "True",
"loc": {
"user001": 4,
"user002": 7
},
"marketType": "fixedPrice",
"maxPriceCtpEU": "null"
}
Now for the other data, I can do something like this:
[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; }
But what to do with the Loc
data?
I can do something like:
public class LocationInfo: Document{
[BsonElement("LocInfo"), JsonProperty(Required = Required.Always)]
public int LocInfo { get; set; }
...
}
and then in Loc
:
[BsonElement("Loc"), JsonProperty(Required = Required.Always)]
public LocationInfo FullfillmentFactor { get; set; }
But here how can I pass multiple values like this:
"loc": {
"user001": 4,
"user002": 7
}
CodePudding user response:
you can define loc as a Dictionary for example
public Dictionary<string,int> loc { get; set; }