I have this object with a Parent property that reference another object of the same type:
[JsonObject(IsReference = true)]
class Group
{
public strin
To expand on James's answer, you can fix this issue by providing a parameterless (default) constructor for Json.Net to use. It can be private if you want, so long as you also mark it with a [JsonConstructor] attribute.
[JsonObject(IsReference = true)]
class Group
{
...
[JsonConstructor]
private Group()
{
}
public Group(string name)
{
Name = name;
Children = new List();
}
...
}
This arrangement allows Json.Net to create the object without needing all the information up front; it can then use the public properties to fill things in afterward.
Fiddle: https://dotnetfiddle.net/QfqV43