1065 references to JsonSerializer
Aspire.Confluent.Kafka (1)
Aspire.Dashboard (2)
Aspire.EndToEnd.Tests (1)
Aspire.Hosting (11)
Aspire.Hosting.Azure (1)
Aspire.Hosting.Azure.Functions (1)
Aspire.Hosting.Azure.ServiceBus (1)
Aspire.Hosting.Testing (1)
Aspire.Hosting.Tests (6)
Aspire.Workload.Tests (1)
AzureSearch.ApiService (1)
BasketService (3)
BicepSample.ApiService (5)
CdkSample.ApiService (2)
ConfigurationSchemaGenerator (1)
dotnet-user-jwts (12)
InMemory.FunctionalTests (1)
Microsoft.AspNetCore.Authentication.Core.Test (4)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (13)
Microsoft.AspNetCore.Authentication.Test (1)
Microsoft.AspNetCore.Authentication.Twitter (1)
Microsoft.AspNetCore.Components (2)
Microsoft.AspNetCore.Components.Endpoints (11)
Microsoft.AspNetCore.Components.Endpoints.Tests (46)
EndpointHtmlRendererTest.cs (45)
66var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
91var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
101var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
134var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
141JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(marker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
146var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
172var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
178var parameterDefinition = Assert.Single(JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(marker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
183var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
209var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
215var parameterDefinition = Assert.Single(JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(preambleMarker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
220var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(preambleMarker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
228var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
259var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
265var parameterDefinition = Assert.Single(JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(preambleMarker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
270var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(preambleMarker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
277var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
317var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
324var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
350var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
357var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
368var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
415var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
420var firstServerComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedFirstServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
426var markerMarker = JsonSerializer.Deserialize<ComponentMarker>(marker, ServerComponentSerializationSettings.JsonSerializationOptions);
431var secondServerComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedSecondServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
468var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
475var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
507var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
514var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
547var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
554var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
574var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
598var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
605var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
625var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
1082var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1089var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
1111var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1118var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
1139var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1142var parameterValues = JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions);
1152var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1155var parameterValues = JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions);
1183var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
Microsoft.AspNetCore.Components.Server (9)
Microsoft.AspNetCore.Components.Server.Tests (6)
Microsoft.AspNetCore.Components.Tests (12)
Microsoft.AspNetCore.Components.Web (5)
Microsoft.AspNetCore.Components.Web.Tests (12)
Microsoft.AspNetCore.Components.WebAssembly (7)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Microsoft.AspNetCore.Components.WebAssembly.Tests (2)
Microsoft.AspNetCore.Components.WebView (4)
Microsoft.AspNetCore.Diagnostics (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (17)
Internal\Json\AnyConverter.cs (5)
50data = (IMessage)JsonSerializer.Deserialize(valueField, descriptor.ClrType, options)!;
54data = (IMessage)JsonSerializer.Deserialize(d.RootElement, descriptor.ClrType, options)!;
89JsonSerializer.Serialize(writer, wrappedValue, wrappedValue.GetType(), options);
93JsonSerializer.Serialize(writer, valueMessage, valueMessage.GetType(), options);
118JsonSerializer.Serialize(writer, value, value.GetType(), options);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (5)
Microsoft.AspNetCore.Grpc.Microbenchmarks (2)
Microsoft.AspNetCore.Hosting (2)
Microsoft.AspNetCore.Http.Abstractions.Tests (12)
ProblemDetailsJsonConverterTest.cs (8)
26JsonSerializer.Deserialize(ref reader, typeof(ProblemDetails), JsonSerializerOptions);
46var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(ref reader, JsonSerializerOptions);
77var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(json, JsonSerializerOptions);
109var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(json, serializerOptions);
141var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(ref reader, JsonSerializerOptions);
181JsonSerializer.Serialize(writer, value, JsonSerializerOptions);
205JsonSerializer.Serialize(writer, value, JsonSerializerOptions);
236JsonSerializer.Serialize(writer, value, JsonSerializerOptions);
Microsoft.AspNetCore.Http.Extensions (16)
HttpRequestJsonExtensions.cs (5)
75return await JsonSerializer.DeserializeAsync<TValue>(inputStream, options, cancellationToken);
113return await JsonSerializer.DeserializeAsync(inputStream, jsonTypeInfo, cancellationToken);
151return await JsonSerializer.DeserializeAsync(inputStream, jsonTypeInfo, cancellationToken);
213return await JsonSerializer.DeserializeAsync(inputStream, type, options, cancellationToken);
255return await JsonSerializer.DeserializeAsync(inputStream, type, context, cancellationToken);
HttpResponseJsonExtensions.cs (10)
99return JsonSerializer.SerializeAsync(response.BodyWriter, value, options, cancellationToken);
130return JsonSerializer.SerializeAsync(response.BodyWriter, value, jsonTypeInfo, cancellationToken);
137await JsonSerializer.SerializeAsync(response.BodyWriter, value, jsonTypeInfo, cancellationToken);
172return JsonSerializer.SerializeAsync(response.BodyWriter, value, jsonTypeInfo, cancellationToken);
179await JsonSerializer.SerializeAsync(response.BodyWriter, value, jsonTypeInfo, cancellationToken);
195await JsonSerializer.SerializeAsync(body, value, options, cancellationToken);
279return JsonSerializer.SerializeAsync(response.BodyWriter, value, type, options, cancellationToken);
293await JsonSerializer.SerializeAsync(body, value, type, options, cancellationToken);
329return JsonSerializer.SerializeAsync(response.BodyWriter, value, type, context, cancellationToken);
336await JsonSerializer.SerializeAsync(body, value, type, context, cancellationToken);
Microsoft.AspNetCore.Http.Extensions.Tests (39)
ProblemDetailsDefaultWriterTest.cs (17)
49var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
87var result = await JsonSerializer.DeserializeAsync<Dictionary<string, object>>(stream, JsonSerializerOptions.Default);
119var result = await JsonSerializer.DeserializeAsync<Dictionary<string, object>>(stream, JsonSerializerOptions.Default);
154var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
194var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
234var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
273var problemDetails = await JsonSerializer.DeserializeAsync<HttpValidationProblemDetails>(stream, SerializerOptions);
316var problemDetails = await JsonSerializer.DeserializeAsync<HttpValidationProblemDetails>(stream, SerializerOptions);
359var problemDetails = await JsonSerializer.DeserializeAsync<CustomProblemDetails>(stream, options.SerializerOptions);
402var problemDetails = await JsonSerializer.DeserializeAsync<CustomProblemDetails>(stream, options.SerializerOptions);
445var problemDetails = await JsonSerializer.DeserializeAsync<CustomProblemDetails>(stream, options.SerializerOptions);
479var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
526var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, options.SerializerOptions);
533var expectedExtension = JsonSerializer.SerializeToElement(customExtensionData, options.SerializerOptions);
559var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
595var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
627var problemDetails = await JsonSerializer.DeserializeAsync<ProblemDetails>(stream, SerializerOptions);
Microsoft.AspNetCore.Http.Microbenchmarks (3)
Microsoft.AspNetCore.Http.Results (1)
Microsoft.AspNetCore.Http.Results.Tests (18)
Microsoft.AspNetCore.Identity.UI (2)
Microsoft.AspNetCore.Mvc.Core (13)
Formatters\SystemTextJsonOutputFormatter.cs (6)
14/// A <see cref="TextOutputFormatter"/> for JSON content that uses <see cref="JsonSerializer"/>.
52/// Gets the <see cref="JsonSerializerOptions"/> used to configure the <see cref="JsonSerializer"/>.
94await JsonSerializer.SerializeAsync(responseWriter, context.Object, jsonTypeInfo, httpContext.RequestAborted);
98await JsonSerializer.SerializeAsync(responseWriter, context.Object, SerializerOptions, httpContext.RequestAborted);
114await JsonSerializer.SerializeAsync(transcodingStream, context.Object, jsonTypeInfo);
118await JsonSerializer.SerializeAsync(transcodingStream, context.Object, SerializerOptions);
Microsoft.AspNetCore.Mvc.Core.Test (20)
Microsoft.AspNetCore.Mvc.FunctionalTests (8)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (11)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (2)
Microsoft.AspNetCore.Mvc.Testing (1)
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
Microsoft.AspNetCore.OpenApi (4)
Microsoft.AspNetCore.OpenApi.Build.Tests (1)
Microsoft.AspNetCore.Routing.FunctionalTests (5)
Microsoft.AspNetCore.SignalR.Protocols.Json (2)
Microsoft.AspNetCore.StaticAssets (1)
Microsoft.AspNetCore.StaticAssets.Tests (1)
Microsoft.Build (5)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.ExternalAccess.Razor (4)
Microsoft.CodeAnalysis.ExternalAccess.Xaml (2)
Microsoft.CodeAnalysis.Features (1)
Microsoft.CodeAnalysis.LanguageServer (1)
Microsoft.CodeAnalysis.LanguageServer.Protocol (43)
Protocol\Internal\Efficiency\OptimizedVSCompletionListJsonConverter.cs (16)
45JsonSerializer.Serialize(writer, completionList.ContinueCharacters, options);
51JsonSerializer.Serialize(writer, completionList.Data, options);
57JsonSerializer.Serialize(writer, completionList.CommitCharacters, options);
90JsonSerializer.Serialize(writer, completionList.ItemDefaults, options);
106jsonString = JsonSerializer.Serialize(vsCompletionItem.Icon, options);
116JsonSerializer.Serialize(writer, vsCompletionItem.Description, options);
124jsonString = JsonSerializer.Serialize(basicCommitCharacters, options);
136jsonString = JsonSerializer.Serialize(augmentedCommitCharacters, options);
156JsonSerializer.Serialize(writer, completionItem.LabelDetails, options);
169JsonSerializer.Serialize(writer, completionItem.Documentation, options);
201JsonSerializer.Serialize(writer, completionItem.TextEdit, options);
207JsonSerializer.Serialize(writer, completionItem.TextEditText, options);
213JsonSerializer.Serialize(writer, completionItem.AdditionalTextEdits, options);
220jsonString = JsonSerializer.Serialize(completionItem.CommitCharacters, options);
231JsonSerializer.Serialize(writer, completionItem.Command, options);
237JsonSerializer.Serialize(writer, completionItem.Data, options);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (11)
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
Microsoft.CommonLanguageServerProtocol.Framework.Package (2)
Microsoft.DotNet.Build.Tasks.Workloads (2)
Microsoft.DotNet.Internal.SymbolHelper (1)
Microsoft.DotNet.XliffTasks (2)
Microsoft.Extensions.AI (23)
Functions\AIFunctionFactory.cs (7)
354JsonElement element => JsonSerializer.Deserialize(element, typeInfo),
355JsonDocument doc => JsonSerializer.Deserialize(doc, typeInfo),
356JsonNode node => JsonSerializer.Deserialize(node, typeInfo),
365string json = JsonSerializer.Serialize(value, serializerOptions.GetTypeInfo(value.GetType()));
366return JsonSerializer.Deserialize(json, typeInfo);
463return JsonSerializer.SerializeToElement(result, returnTypeInfo);
468await JsonSerializer.SerializeAsync(stream, result, returnTypeInfo, cancellationToken).ConfigureAwait(false);
Microsoft.Extensions.AI.Abstractions (10)
Microsoft.Extensions.AI.Abstractions.Tests (69)
ChatCompletion\ChatResponseFormatTests.cs (9)
42Assert.Equal("{}", JsonSerializer.Serialize(f.Schema, TestJsonSerializerContext.Default.JsonElement));
50string json = JsonSerializer.Serialize(ChatResponseFormat.Text, TestJsonSerializerContext.Default.ChatResponseFormat);
53ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat);
60string json = JsonSerializer.Serialize(ChatResponseFormat.Json, TestJsonSerializerContext.Default.ChatResponseFormat);
63ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat);
73string json = JsonSerializer.Serialize(
74ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("[1,2,3]"), "name", "description"),
78ChatResponseFormat? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatResponseFormat);
80Assert.Equal("[1,2,3]", JsonSerializer.Serialize(actual.Schema, TestJsonSerializerContext.Default.JsonElement));
Contents\FunctionCallContentTests..cs (9)
84var json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options);
85var deserializedSut = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options);
119Dictionary<string, object?> arguments = JsonSerializer.Deserialize<Dictionary<string, object?>>("""
153var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>("""
174var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonNode>>("""
195var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>("""
213Dictionary<string, object?> arguments = JsonSerializer.Deserialize<Dictionary<string, object?>>("""
231var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonNode>>("""
265argumentParser: static json => JsonSerializer.Deserialize<Dictionary<string, object?>>(json));
Microsoft.Extensions.AI.AzureAIInference (11)
AzureAIInferenceChatClient.cs (10)
311result.AdditionalProperties["top_k"] = new BinaryData(JsonSerializer.SerializeToUtf8Bytes(topK, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(int))));
324byte[] data = JsonSerializer.SerializeToUtf8Bytes(prop.Value, ToolCallJsonSerializerOptions.GetTypeInfo(typeof(object)));
370var tool = JsonSerializer.Deserialize(schema, JsonContext.Default.AzureAIChatToolJson)!;
376["properties"] = BinaryData.FromBytes(JsonSerializer.SerializeToUtf8Bytes(tool.Properties, JsonContext.Default.DictionaryStringJsonElement)),
377["required"] = BinaryData.FromBytes(JsonSerializer.SerializeToUtf8Bytes(tool.Required, JsonContext.Default.ListString)),
402var tool = JsonSerializer.Deserialize(aiFunction.JsonSchema, JsonContext.Default.AzureAIChatToolJson)!;
403var functionParameters = BinaryData.FromBytes(JsonSerializer.SerializeToUtf8Bytes(tool, JsonContext.Default.AzureAIChatToolJson));
438result = JsonSerializer.Serialize(resultContent.Result, ToolCallJsonSerializerOptions.GetTypeInfo(typeof(object)));
470JsonSerializer.Serialize(callRequest.Arguments, ToolCallJsonSerializerOptions.GetTypeInfo(typeof(IDictionary<string, object>))))));
530argumentParser: static json => JsonSerializer.Deserialize(json,
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Microsoft.Extensions.AI.Evaluation.Reporting (12)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (6)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (14)
Microsoft.Extensions.AI.Evaluation.Tests (1)
Microsoft.Extensions.AI.Integration.Tests (4)
Microsoft.Extensions.AI.Ollama (6)
Microsoft.Extensions.AI.Ollama.Tests (1)
Microsoft.Extensions.AI.OpenAI (22)
Microsoft.Extensions.AI.OpenAI.Tests (2)
Microsoft.Extensions.AI.Tests (18)
Microsoft.Extensions.Caching.Hybrid (2)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.JSInterop (8)
Microsoft.JSInterop.Tests (58)
Infrastructure\ByteArrayJsonConverterTest.cs (15)
25var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
38var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
51var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
64var ex = Record.Exception(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
73var json = JsonSerializer.Serialize(expected);
76var deserialized = JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)!;
89var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
105var deserialized = JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)!;
121var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
137var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
153var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
169var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions));
188var deserialized = JsonSerializer.Deserialize<byte[]>(json, JsonSerializerOptions)!;
210var deserialized = JsonSerializer.Deserialize<byte[][]>(json, JsonSerializerOptions)!;
226var json = JsonSerializer.Serialize(byteArray, JsonSerializerOptions);
Infrastructure\DotNetDispatcherTest.cs (17)
91var result = JsonSerializer.Deserialize<TestDTO>(resultJson, jsRuntime.JsonSerializerOptions);
104var result = JsonSerializer.Deserialize<TestDTO>(resultJson, jsRuntime.JsonSerializerOptions);
121var argsJson = JsonSerializer.Serialize(new object[]
134var resultDto1 = JsonSerializer.Deserialize<TestDTO>(root[0].GetRawText(), jsRuntime.JsonSerializerOptions);
161var argsJson = JsonSerializer.Serialize(new object[]
269var argsJson = JsonSerializer.Serialize(new object[] { jsRuntime.LastInvocationAsyncHandle, true, testDTO }, jsRuntime.JsonSerializerOptions);
290var argsJson = JsonSerializer.Serialize(new object[] { jsRuntime.LastInvocationAsyncHandle, false, expected }, jsRuntime.JsonSerializerOptions);
306var argsJson = JsonSerializer.Serialize(new object[] { jsRuntime.LastInvocationAsyncHandle, false, null }, jsRuntime.JsonSerializerOptions);
323var argsJson = JsonSerializer.Serialize(new object[] { jsRuntime.LastInvocationAsyncHandle, true, testDTO }, jsRuntime.JsonSerializerOptions);
522var result = JsonSerializer.Deserialize<TestDTO>(resultJson, jsRuntime.JsonSerializerOptions);
525var result2 = JsonSerializer.Deserialize<TestDTO>(resultJson2, jsRuntime.JsonSerializerOptions);
580var argsJson = JsonSerializer.Serialize(new object[]
601var argsJson = JsonSerializer.Serialize(new object[]
630var argsJson = JsonSerializer.Serialize(new object[]
646var result = JsonSerializer.Deserialize<SomePublicType.InvokableAsyncMethodResult>(resultJson, jsRuntime.JsonSerializerOptions);
669var argsJson = JsonSerializer.Serialize(new object[]
697var argsJson = JsonSerializer.Serialize(new object[] { }, jsRuntime.JsonSerializerOptions);
Microsoft.Maui (7)
Microsoft.ML.AutoML (5)
Microsoft.ML.AutoML.Interactive (4)
Microsoft.ML.AutoML.SourceGenerator (5)
Microsoft.ML.AutoML.Tests (17)
Microsoft.ML.GenAI.LLaMA (7)
Microsoft.ML.GenAI.Mistral (8)
Microsoft.ML.GenAI.Phi (8)
Microsoft.ML.GenAI.Phi.Tests (1)
Microsoft.ML.GenAI.Samples (1)
Microsoft.ML.SearchSpace (24)
Microsoft.ML.SearchSpace.Tests (6)
Microsoft.ML.Tokenizers (4)
Microsoft.ML.Tokenizers.Tests (7)
OrderProcessor (1)
RunTests (1)
Shared (1)
Shared.Tests (4)
System.Memory.Data (14)
System\BinaryData.cs (14)
79/// using <see cref="JsonSerializer"/>.
83/// <see cref="JsonSerializer"/>.</param>
91JsonSerializer.SerializeToUtf8Bytes(jsonSerializable, type ?? jsonSerializable?.GetType() ?? typeof(object), options),
98/// using <see cref="JsonSerializer"/>
102/// <see cref="JsonSerializer"/>.</param>
108JsonSerializer.SerializeToUtf8Bytes(jsonSerializable, type ?? jsonSerializable?.GetType() ?? typeof(object), context),
386/// the <see cref="JsonSerializer"/>
397=> new BinaryData(JsonSerializer.SerializeToUtf8Bytes(jsonSerializable, options), MediaTypeApplicationJson);
401/// the <see cref="JsonSerializer"/>
410=> new BinaryData(JsonSerializer.SerializeToUtf8Bytes(jsonSerializable, jsonTypeInfo), MediaTypeApplicationJson);
469/// <see cref="JsonSerializer"/>.
478=> JsonSerializer.Deserialize<T>(GetBytesWithTrimmedBom(), options);
482/// <see cref="JsonSerializer"/>.
489=> JsonSerializer.Deserialize(GetBytesWithTrimmedBom(), jsonTypeInfo);
System.Net.Http.Json (14)
System\Net\Http\Json\HttpClientJsonExtensions.cs (4)
20FromJsonAsyncCore(getMethod, client, requestUri, static (stream, options, cancellation) => JsonSerializer.DeserializeAsync(stream, options.type, options.options ?? JsonSerializerOptions.Web, cancellation), (type, options), cancellationToken);
25FromJsonAsyncCore(getMethod, client, requestUri, static (stream, options, cancellation) => JsonSerializer.DeserializeAsync<TValue>(stream, options ?? JsonSerializerOptions.Web, cancellation), options, cancellationToken);
28FromJsonAsyncCore(getMethod, client, requestUri, static (stream, options, cancellation) => JsonSerializer.DeserializeAsync(stream, options.type, options.context, cancellation), (type, context), cancellationToken);
31FromJsonAsyncCore(getMethod, client, requestUri, static (stream, options, cancellation) => JsonSerializer.DeserializeAsync(stream, options, cancellation), jsonTypeInfo, cancellationToken);
System\Net\Http\Json\HttpContentJsonExtensions.cs (4)
94return await JsonSerializer.DeserializeAsync(contentStream, type, options ?? JsonSerializerOptions.Web, cancellationToken).ConfigureAwait(false);
104return await JsonSerializer.DeserializeAsync<T>(contentStream, options ?? JsonSerializerOptions.Web, cancellationToken).ConfigureAwait(false);
132return await JsonSerializer.DeserializeAsync(contentStream, type, context, cancellationToken).ConfigureAwait(false);
140return await JsonSerializer.DeserializeAsync(contentStream, jsonTypeInfo, cancellationToken).ConfigureAwait(false);
System.Private.Windows.Core (6)
System.Private.Windows.Core.Tests (1)
System.Text.Json (173)
System\Text\Json\Serialization\Converters\Object\ObjectDefaultConverter.cs (10)
71if (!JsonSerializer.TryReadMetadata(this, jsonTypeInfo, ref reader, ref state))
79value = JsonSerializer.ResolveReferenceId<T>(ref state);
102JsonSerializer.ValidateMetadataForObjectConverter(ref state);
107value = JsonSerializer.ResolveReferenceId<T>(ref state);
175ReadOnlySpan<byte> unescapedPropertyName = JsonSerializer.GetPropertyName(ref state, ref reader, options, out bool isAlreadyReadMetadataProperty);
184jsonPropertyInfo = JsonSerializer.LookupProperty(
292ReadOnlySpan<byte> unescapedPropertyName = JsonSerializer.GetPropertyName(ref state, ref reader, options, out bool isAlreadyReadMetadataProperty);
296JsonPropertyInfo jsonPropertyInfo = JsonSerializer.LookupProperty(
335JsonSerializer.WriteMetadataForObject(this, ref state, writer);
378JsonSerializer.WriteMetadataForObject(this, ref state, writer);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (9)
106JsonSerializer.CreateExtensionDataProperty(obj, jsonPropertyInfo, options);
134if (!JsonSerializer.TryReadMetadata(this, jsonTypeInfo, ref reader, ref state))
142value = JsonSerializer.ResolveReferenceId<T>(ref state);
180JsonSerializer.ValidateMetadataForObjectConverter(ref state);
185value = JsonSerializer.ResolveReferenceId<T>(ref state);
238JsonSerializer.CreateExtensionDataProperty(obj, jsonPropertyInfo, options);
302ReadOnlySpan<byte> unescapedPropertyName = JsonSerializer.GetPropertyName(ref state, ref reader, options, out bool isAlreadyReadMetadataProperty);
412ReadOnlySpan<byte> unescapedPropertyName = JsonSerializer.GetPropertyName(ref state, ref reader, options, out bool isAlreadyReadMetadataProperty);
607jsonPropertyInfo = JsonSerializer.LookupProperty(
System\Text\Json\Serialization\Metadata\JsonTypeInfoOfT.WriteHelpers.cs (8)
69int flushThreshold = (int)(Options.DefaultBufferSize * JsonSerializer.FlushThreshold);
79int flushThreshold = (int)(4 * PipeOptions.Default.MinimumSegmentSize * JsonSerializer.FlushThreshold);
307state.FlushThreshold = (int)(bufferWriter.Capacity * JsonSerializer.FlushThreshold);
337=> Serialize(writer, JsonSerializer.UnboxOnWrite<T>(rootValue), rootValue);
340=> SerializeAsync(pipeWriter, JsonSerializer.UnboxOnWrite<T>(rootValue), flushThreshold, cancellationToken, rootValue);
343=> SerializeAsync(utf8Json, JsonSerializer.UnboxOnWrite<T>(rootValue), cancellationToken, rootValue);
346=> SerializeAsync(utf8Json, JsonSerializer.UnboxOnWrite<T>(rootValue), cancellationToken, rootValue);
349=> Serialize(utf8Json, JsonSerializer.UnboxOnWrite<T>(rootValue), rootValue);
System.Windows.Forms.Tests (9)
Templates.Blazor.Tests (2)
Templates.Blazor.WebAssembly.Auth.Tests (1)
Templates.Blazor.WebAssembly.Tests (1)
Templates.Mvc.Tests (1)
Templates.Tests (1)
TestDiscoveryWorker (1)
TestProject.AppHost (1)
Wasm.Performance.Driver (2)