JSON.NET Error Self referencing loop detected for type when Serialize

Sep 13, 2011 at 6:24 AM

Hi all,

Please help me solve my problem, i try to serialize POCO class that automatic generate from Enity Data Model .edmx and when i used

JsonConvert.SerializeObject 

Error Self referencing loop detected for type System.data.entity occurs .

How to solve it ? Any ideas ? Thanks in advance !
Oct 21, 2011 at 10:41 PM

for that you can use 

ReferenceLoopHandling 

when u are calling jsonconvert 

public static string SerializeObject(
	Object value,
	Formatting formatting,
	JsonSerializerSettings settings
)

in JsonSerializerSettings u can set the property ReferenceLoopHandling as ignore.