Json.Net adding $id to EF objects despite setting PreserveReferencesHandling to "None"
Solution 1:
The custom ContractResolver
setting overrides the PreserveReferencesHandling
setting.
In your implementation of DefaultContractResolver
/IContractResolver
, add this;
public override JsonContract ResolveContract(Type type) {
var contract = base.ResolveContract(type);
contract.IsReference = false;
return contract;
}
This behaves similarly to the PreserveReferencesHandling.None
setting without a custom ContractResolver
.