You don't have one object with the same property twice; you have an array containing two objects, each of which has the
id
and
parentId
properties
once.
Serialize a list of
TagModel
objects, and you should get the expected JSON output.
[Serializable]
public class TagModel
{
public int id { get; set; }
public int parentId { get; set; }
}
...
var objectToSerialize = new List<TagModel>
{
new TagModel { id = -2147483639, parentId = 37 },
new TagModel { id = -2147483636, parentId = 35 },
};
string json = JsonConvert.SerializeObject(objectToSerialize);