I've got an ASP.NET MVC site with a controller action that is returning JSON. The JSON is serialized via Newtonsoft's JSON.NET, with
' This is VB, even though it looks very C#-like.
result =
JsonConvert.SerializeObject(
Data, Formatting.Indented,
New JsonSerializerSettings With {
.ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
.PreserveReferencesHandling = PreserveReferencesHandling.Objects
})
Note the .PreserveReferencesHandling = PreserveReferencesHandling.Objects
.
The consumer of this serialized data is javascript in the browser.
So how can I get the consumer, javascript, to play nice with the references that JSON.NET generated? I don't have to scan the entire object hierarchy looking for the object that has the correct $id
property, do I?