public override Task <object> DeserializeWrapper(string json, Type type, JsonSerializerContext context) { if (json is null) { // Emulate a null document for API validation tests. return(Task.FromResult(JsonSerializer.Deserialize(node: null, type, context?.Options))); } JsonNode node = JsonNode.Parse(json, OptionsHelpers.GetNodeOptions(context?.Options), OptionsHelpers.GetDocumentOptions(context?.Options)); return(Task.FromResult(node.Deserialize(type, context))); }
public override Task <T> DeserializeWrapper <T>(string json, JsonTypeInfo <T> jsonTypeInfo) { if (json is null) { // Emulate a null node for API validation tests. return(Task.FromResult(JsonSerializer.Deserialize(node: null, jsonTypeInfo))); } JsonNode node = JsonNode.Parse(json, OptionsHelpers.GetNodeOptions(jsonTypeInfo?.Options), OptionsHelpers.GetDocumentOptions(jsonTypeInfo?.Options)); return(Task.FromResult(node.Deserialize <T>(jsonTypeInfo))); }