You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a class like blow
`class A
{
public B {get;set;}
}
class C
{
public B {get;set;}
}
Now the target to serialize is like this:
var b = new B();
var a = new A(){
B = b
}
var c = new C(){
B = b
}
var serializeTarget = new List{a, c}
`
I used ReferenceHandler.Preserve as my ReferenceHandler, but when i check the json result, I found that the instance: b was serialized twice, and i found that the "$id" generated seems like reset to 1 when i call blow methow in my JsonConverter
I doubt it cause by the "ReferenceHandler.CreateResolver()",
I write a custom Referencehandler to return a sington resolver hope to resolve this
Now it seems OK, but when I deserialize the result json, it gives me:
It seems caused by this node {"$ref"...}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a class like blow
`class A
{
public B {get;set;}
}
class C
{
public B {get;set;}
}
Now the target to serialize is like this:

var b = new B();
var a = new A(){
B = b
}
var c = new C(){
B = b
}
var serializeTarget = new List{a, c}
`
I used ReferenceHandler.Preserve as my ReferenceHandler, but when i check the json result, I found that the instance: b was serialized twice, and i found that the "$id" generated seems like reset to 1 when i call blow methow in my JsonConverter
I doubt it cause by the "ReferenceHandler.CreateResolver()",

I write a custom Referencehandler to return a sington resolver hope to resolve this




Now it seems OK, but when I deserialize the result json, it gives me:
It seems caused by this node {"$ref"...}
Beta Was this translation helpful? Give feedback.
All reactions