DARIUSH_OFF
New Member
I'm working on a proof-of-concept and ran into an issue involving serializing a Request object using a simple JSON.Encode() as follows : \[code\]//This is very unkind and throws circular references like crazyJSON.Encode(HttpContext.Request)\[/code\]Now I know that there are many, many different properties and members within the Request that could be the cause of the circular reference, but I was wondering what the best method to handle it would be?I don't mind ignoring the fields / properties that are actually causing the issue, but I would like to retrieve as much information as possible without actually manually serializing specific properties as seen below : \[code\]JSON.Encode(new {HttpContext.Request.Cookies,HttpContext.Request.Headers, ... });\[/code\]Any and all suggestions are more than welcome Previous Attempts
- Using Reflection to iterate through each of the Properties and attempting to "build" a JSON string property-by-property.
- Attempting to store each of the individual properties within a Dictionary in hopes that the JSON serializer would "flatten" the object and ignore the references.