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