I have the following dictionary:
[JsonProperty("Simulations")]
public IDictionary<int, Simulation> Simulations { get; set; }
Actual behavior:
When I'm sending my data to the front I send it as an object:
"simulations": {
"02": {
"rachatBrut": 542,
"montantPercu": 250,
},
"52": {
"rachatBrut": 400,
"montantPercu": 385,
},
}
Wanted Behavior
I want to send only the values of the dictionary as an array:
"simulations": [
{
"rachatBrut": 542,
"montantPercu": 250,
},
{
"rachatBrut": 400,
"montantPercu": 385,
}
]
JsonIgnorethe existing property. Create a new readonly property which projects the array you want in the JSON.