996 references to JsonSerializer
Aspire.Confluent.Kafka (1)
Aspire.Dashboard (2)
Aspire.EndToEnd.Tests (1)
Aspire.Hosting (10)
Aspire.Hosting.Azure (1)
Aspire.Hosting.Azure.Functions (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 (11)
Microsoft.AspNetCore.Authentication.Test (1)
Microsoft.AspNetCore.Authentication.Twitter (1)
Microsoft.AspNetCore.Components (2)
Microsoft.AspNetCore.Components.Endpoints (10)
Microsoft.AspNetCore.Components.Endpoints.Tests (46)
EndpointHtmlRendererTest.cs (45)
64var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
88var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
98var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
130var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
137JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(marker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
142var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
167var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
173var parameterDefinition = Assert.Single(JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(marker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
178var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
203var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
209var parameterDefinition = Assert.Single(JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(preambleMarker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
214var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(preambleMarker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
222var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
252var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
258var parameterDefinition = Assert.Single(JsonSerializer.Deserialize<ComponentParameter[]>(Convert.FromBase64String(preambleMarker.ParameterDefinitions), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
263var value = Assert.Single(JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(preambleMarker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions));
270var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
310var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
317var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
343var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
350var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
361var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
408var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
413var firstServerComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedFirstServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
419var markerMarker = JsonSerializer.Deserialize<ComponentMarker>(marker, ServerComponentSerializationSettings.JsonSerializationOptions);
424var secondServerComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedSecondServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
461var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
468var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
500var marker = JsonSerializer.Deserialize<ComponentMarker>(match.Groups[1].Value, ServerComponentSerializationSettings.JsonSerializationOptions);
507var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
540var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
547var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
567var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
591var preambleMarker = JsonSerializer.Deserialize<ComponentMarker>(preamble, ServerComponentSerializationSettings.JsonSerializationOptions);
598var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
618var epilogueMarker = JsonSerializer.Deserialize<ComponentMarker>(epilogue, ServerComponentSerializationSettings.JsonSerializationOptions);
1074var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1081var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
1103var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1110var serverComponent = JsonSerializer.Deserialize<ServerComponent>(unprotectedServerComponent, ServerComponentSerializationSettings.JsonSerializationOptions);
1131var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1134var parameterValues = JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions);
1144var marker = JsonSerializer.Deserialize<ComponentMarker>(markerText, ServerComponentSerializationSettings.JsonSerializationOptions);
1147var parameterValues = JsonSerializer.Deserialize<object[]>(Convert.FromBase64String(marker.ParameterValues), WebAssemblyComponentSerializationSettings.JsonSerializationOptions);
1173var 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 (6)
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.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.Routing.FunctionalTests (5)
Microsoft.AspNetCore.SignalR.Protocols.Json (2)
Microsoft.AspNetCore.StaticAssets (1)
Microsoft.AspNetCore.StaticAssets.Tests (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
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 (9)
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 (24)
Functions\AIFunctionFactory.cs (7)
322return JsonSerializer.SerializeToElement(result, _returnTypeInfo);
328await JsonSerializer.SerializeAsync(stream, result, _returnTypeInfo, cancellationToken).ConfigureAwait(false);
381JsonElement element => JsonSerializer.Deserialize(element, typeInfo),
382JsonDocument doc => JsonSerializer.Deserialize(doc, typeInfo),
383JsonNode node => JsonSerializer.Deserialize(node, typeInfo),
392string json = JsonSerializer.Serialize(value, options.SerializerOptions.GetTypeInfo(value.GetType()));
393return JsonSerializer.Deserialize(json, typeInfo);
Microsoft.Extensions.AI.Abstractions (7)
Microsoft.Extensions.AI.Abstractions.Tests (64)
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\DataContentTests{T}.cs (10)
131JsonSerializer.Serialize(CreateDataContent("data:,"), TestJsonSerializerContext.Default.Options));
135JsonSerializer.Serialize(CreateDataContent(new Uri("http://localhost/")), TestJsonSerializerContext.Default.Options));
139JsonSerializer.Serialize(CreateDataContent(
144JsonSerializer.Serialize(CreateDataContent(
154Assert.Throws<ArgumentNullException>("uri", () => JsonSerializer.Deserialize<DataContent>(json, TestJsonSerializerContext.Default.Options)!);
161var content = JsonSerializer.Deserialize<DataContent>("""{"mediaType":"application/octet-stream","uri":"data:;base64,AQIDBA=="}""", TestJsonSerializerContext.Default.Options)!;
170content = JsonSerializer.Deserialize<DataContent>("""{"mediaType":"application/octet-stream","uri":"http://localhost/"}""", TestJsonSerializerContext.Default.Options)!;
178content = JsonSerializer.Deserialize<DataContent>("""
213var content = JsonSerializer.Deserialize<DataContent>(serialized, TestJsonSerializerContext.Default.Options)!;
214var reSerialization = JsonSerializer.Serialize(content, TestJsonSerializerContext.Default.Options);
Contents\FunctionCallContentTests..cs (9)
86var json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options);
87var deserializedSut = JsonSerializer.Deserialize<FunctionCallContent>(json, TestJsonSerializerContext.Default.Options);
121Dictionary<string, object?> arguments = JsonSerializer.Deserialize<Dictionary<string, object?>>("""
155var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>("""
176var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonNode>>("""
197var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>("""
215Dictionary<string, object?> arguments = JsonSerializer.Deserialize<Dictionary<string, object?>>("""
233var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonNode>>("""
279argumentParser: static json => JsonSerializer.Deserialize<Dictionary<string, object?>>(json));
Microsoft.Extensions.AI.AzureAIInference (7)
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
Microsoft.Extensions.AI.Integration.Tests (4)
Microsoft.Extensions.AI.Ollama (5)
Microsoft.Extensions.AI.Ollama.Tests (1)
Microsoft.Extensions.AI.OpenAI (13)
Microsoft.Extensions.AI.OpenAI.Tests (1)
Microsoft.Extensions.AI.Tests (18)
Microsoft.Extensions.Caching.Hybrid (2)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.JSInterop (8)
Microsoft.JSInterop.Tests (56)
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 (15)
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);
544var argsJson = JsonSerializer.Serialize(new object[]
565var argsJson = JsonSerializer.Serialize(new object[]
594var argsJson = JsonSerializer.Serialize(new object[]
610var result = JsonSerializer.Deserialize<SomePublicType.InvokableAsyncMethodResult>(resultJson, jsRuntime.JsonSerializerOptions);
633var argsJson = JsonSerializer.Serialize(new object[]
661var argsJson = JsonSerializer.Serialize(new object[] { }, jsRuntime.JsonSerializerOptions);
Microsoft.Maui (4)
Microsoft.Maui.Essentials (4)
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.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);
332=> Serialize(writer, JsonSerializer.UnboxOnWrite<T>(rootValue), rootValue);
335=> SerializeAsync(pipeWriter, JsonSerializer.UnboxOnWrite<T>(rootValue), flushThreshold, cancellationToken, rootValue);
338=> SerializeAsync(utf8Json, JsonSerializer.UnboxOnWrite<T>(rootValue), cancellationToken, rootValue);
341=> SerializeAsync(utf8Json, JsonSerializer.UnboxOnWrite<T>(rootValue), cancellationToken, rootValue);
344=> Serialize(utf8Json, JsonSerializer.UnboxOnWrite<T>(rootValue), rootValue);
System.Windows.Forms (7)
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)