We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently circular references will cause infinite loops in serialization and de-serialization.
This self-referential tree structure...
class Test { public Test Left; public Test Right; } Test Root; Root.Left = new Test(); Root.Right = Root;
...should be serialized as:
{ "$id": 1, "Left": { "Left": null, "Right": null }, "Right": { "$ref": 1 } }
$id gives a specific object in the json heirarchy an ID. These IDs should be unique per-document, but don't need to be a GUID. Smaller is better.
$id
$ref indicates that the object containing the $ref key should be replaced by the object who's $id value is 1.
$ref
Additionally, this should be used to de-dupe objects that are serialized multiple times.
For example, the following...
class Test { public int Value; public double Amount; public string Name; } var data = new List<Test>(); var testData = new Test { Value = 42, Amount = 10.5, Name = "test name" }; data.Add(testData); data.Add(testData); data.Add(testData);
...should be serialized as
[ { "$id": 1, "Value": 42, "Amount": 10.5, "Name": "test name" }, { "$ref": 1 }, { "$ref": 1 } ]
The text was updated successfully, but these errors were encountered:
grahamboree
No branches or pull requests
Currently circular references will cause infinite loops in serialization and de-serialization.
This self-referential tree structure...
...should be serialized as:
$id
gives a specific object in the json heirarchy an ID. These IDs should be unique per-document, but don't need to be a GUID. Smaller is better.$ref
indicates that the object containing the$ref
key should be replaced by the object who's$id
value is 1.Additionally, this should be used to de-dupe objects that are serialized multiple times.
For example, the following...
...should be serialized as
The text was updated successfully, but these errors were encountered: