I'm looking to construct a C# object to produce the following JSON array:
["Key":"SomeKeyValue", "Key":"SomeKeyValue"]
Using a list gives me the array I'm after, but with a object name in the resulting JSON:
Public Class SomeOtherClass
{
public string Key {get; set;}
}
Public Class SomeObject
{
public List<SomeOtherClass> PropertyName { get; set; }
}
// JSON
{"PropertyName":[ {"Key":"SomeValue"} ] }
I need to drop the name of the object in the resulting JSON. Using a Dictionary<string,string> gives me what I'm after but with the Object syntax {} in the JSON instead if the Array []:
{
...
}
Trying to avoid custom serializer and contracts here if possible. I'm sure that NewtonSoft must have some magic attribute here?
Found a few related questions on the net, but none that resolves removing the property name. Any suggestions?