Haziran 30, 2022

System.Text.Json.JsonException hatası - cycle or if the object depth is larger than the maximum allowed depth of 32.

 Eğer .net'te aşağıdaki hatayı alıyorsanız;

"A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32."

Startup.cs dosyanızda yer alan ConfigureServices metoduna aşağıdaki kodu ekleyin: 


 services.AddControllers()
.AddNewtonsoftJson(opt=>opt.SerializerSettings
.ReferenceLoopHandling=ReferenceLoopHandling.Ignore);           


Tabi eklemeden önce nuget pmden Newtonsoftson paketini projenize yükleyin. 

Hiç yorum yok:

Yorum Gönder

System.Text.Json.JsonException hatası - cycle or if the object depth is larger than the maximum allowed depth of 32.

 Eğer .net'te aşağıdaki hatayı alıyorsanız; " A possible object cycle was detected which is not supported. This can either be due t...