json.net serializer supports to ignore circular reference on global setting. A quick fix is to put following code in WebApiConfig.cs file:
config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
The simple fix will make serializer to ignore the reference which will cause a loop. However, it has limitations:
The data loses the looping reference information
The fix only applies to JSON.net
The level of references can't be controlled if there is a deep reference chain
json.net serializer supports to ignore circular reference on global setting. A quick fix is to put following code in WebApiConfig.cs file:
config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
The simple fix will make serializer to ignore the reference which will cause a loop. However, it has limitations:
The data loses the looping reference information
The fix only applies to JSON.net
The level of references can't be controlled if there is a deep reference chain