Created
May 18, 2015 10:55
-
-
Save alxsimo/8eaa5d41c4efc6816c01 to your computer and use it in GitHub Desktop.
[C#] Serialize JSON with circular references
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var serializerSettings = new JsonSerializerSettings | |
{ | |
PreserveReferencesHandling = PreserveReferencesHandling.Objects, | |
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore | |
}; | |
string json = JsonConvert.SerializeObject(afectados, Formatting.Indented, serializerSettings); | |
return Content(JsonConvert.SerializeObject(afectados, Formatting.Indented, serializerSettings)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment