Serialize DataSet with current version of System.Text.Json.JsonSerializer

前端 未结 2 1654
忘了有多久
忘了有多久 2021-01-23 15:41

Do you have any advice on how we can serialize DataSet,DataTable with System.Text.Json.JsonSerializer ?
Currently it throws this exceptio

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-23 16:02

    Reference loop handling is not currently supported using System.Text.Json. Workarounds:

    .Net Core 3.0 possible object cycle was detected which is not supported

    https://www.thecodebuzz.com/jsonexception-possible-object-cycle-detected-object-depth/

    You could add custom converters on the offending property to deal with an object referring to itself or just add a JsonIgnore attribute to the offending property.

提交回复
热议问题