About arrays in object

Dec 22, 2014 at 7:20 PM
This seems like a very neat tool, but I have a question about how it deals with arrays of pairs. It may be normal behavior or I may be doing something wrong, but it seems very odd. Lets see if I can make it short.

If I take some JSON data like below and run it through the Generator, it produces a class like the one below that.
If I deserialize that data (using NewtonSoft) I get the object, and it has properties for the first 2 pairs as expected and there are then an ObjectsContents[3] array containing 3 ObjectContent objects (which I think should be name values pairs, but are) array with 3 name value pairs in them. Of each of the 3 pairs, one value is correct and the others ares null. something like the Result here. I don't know. I may be using the JSON wrong. Any suggestions would be appreciated. Thanks, Mike

*** Result ***
"ObjectID":"101",
"ObjectName":"ObjectNamedO",
ObjectContent[0]
"Balls":null 
"Jacks":"bronze" 
"Strings":null 
ObjectContent[1]
"Balls":"rubber" 
"Jacks":null 
"Strings":null 
ObjectContent[2]
"Balls":null 
"Jacks":null,
"Strings":"Orlon" 
*** What I want basically ***
"ObjectID":"101",
"ObjectName":"ObjectNamedO",
ObjectContents[3]:
"Balls":"rubber", 
"Jacks":"bronze", 
"Strings":"Orlon" 
*** Original JSON data entered into Generator ***
{
"ObjectID":"101",
"ObjectName":"ObjectNamedO",
"ObjectContents": [
{ "Jacks":"bronze" },
{ "Balls":"rubber" },
{ "Strings":"Orlon" }
]
}

*** Classes it created ***
internal partial class JSON_Objects
{
internal class ObjectContent
{
    [JsonProperty("Jacks")]
    public string Jacks { get; set; }

    [JsonProperty("Balls")]
    public string Balls { get; set; }

    [JsonProperty("Strings")]
    public string Strings { get; set; }
}
}

internal partial class JSON_Objects
{
[JsonProperty("ObjectID")]
public string ObjectID { get; set; }

[JsonProperty("ObjectName")]
public string ObjectName { get; set; }

[JsonProperty("ObjectContents")]
public ObjectContent[] ObjectContents { get; set; }
}