This bug occurs when using jQuery POST to send complex JavaScript objects to the server as encoded HTTP form data.
For example, if I need to post the following object:
```
{
singleProperty: 'hello',
arrayProperty: [
{
propertyOne: 1,
propertyTwo: 'Two',
},
{
propertyOne: 2,
propertyTwo: 'Four',
},
{
propertyOne: 3,
propertyTwo: 'Six',
}
]
}
```
Then when jQuery posts that object as form data, it posts the following (line breaks added for readability):
"singleProperty=hello&
arrayProperty[0][propertyOne]=1&
arrayProperty[0][propertyTwo]=Two&
arrayProperty[1][propertyOne]=2&
arrayProperty[1][propertyTwo]=Four&
arrayProperty[2][propertyOne]=3&
arrayProperty[2][propertyTwo]=Six"
But ASP.NET MVC is expecting this (line breaks added for readability):
"singleProperty=hello&
arrayProperty[0].propertyOne=1&
arrayProperty[0].propertyTwo=Two&
arrayProperty[1].propertyOne=2&
arrayProperty[1].propertyTwo=Four&
arrayProperty[2].propertyOne=3&
arrayProperty[2].propertyTwo=Six"
The result of this discrepancy is that the properties inside of each of the collection elements of the action parameter object are all defaulted.
I have attached a small project that exemplifies this behavior.
For example, if I need to post the following object:
```
{
singleProperty: 'hello',
arrayProperty: [
{
propertyOne: 1,
propertyTwo: 'Two',
},
{
propertyOne: 2,
propertyTwo: 'Four',
},
{
propertyOne: 3,
propertyTwo: 'Six',
}
]
}
```
Then when jQuery posts that object as form data, it posts the following (line breaks added for readability):
"singleProperty=hello&
arrayProperty[0][propertyOne]=1&
arrayProperty[0][propertyTwo]=Two&
arrayProperty[1][propertyOne]=2&
arrayProperty[1][propertyTwo]=Four&
arrayProperty[2][propertyOne]=3&
arrayProperty[2][propertyTwo]=Six"
But ASP.NET MVC is expecting this (line breaks added for readability):
"singleProperty=hello&
arrayProperty[0].propertyOne=1&
arrayProperty[0].propertyTwo=Two&
arrayProperty[1].propertyOne=2&
arrayProperty[1].propertyTwo=Four&
arrayProperty[2].propertyOne=3&
arrayProperty[2].propertyTwo=Six"
The result of this discrepancy is that the properties inside of each of the collection elements of the action parameter object are all defaulted.
I have attached a small project that exemplifies this behavior.