Deserializing $ref and $id

后端 未结 3 503
梦如初夏
梦如初夏 2021-01-07 05:03

So I\'m trying to deserialize an object that has properties: $ref and $id. I have tried going between Dictionary as well as an object where I have specified namingconvention

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-07 05:27

    This answer worked for me: Json.Net adding $id to EF objects despite setting PreserveReferencesHandling to "None"

    In your implementation of DefaultContractResolver/IContractResolver, add this;

    public override JsonContract ResolveContract(Type type) {
        var contract = base.ResolveContract(type);
        contract.IsReference = false;
        return contract;
    }
    

提交回复
热议问题