9 instantiations of JsonElement
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
TargetPickerUi.cs (1)
222JsonElement consoleActor = new();
Microsoft.Build (1)
Construction\Solution\SolutionFile.cs (1)
665solution = new JsonElement();
System.Text.Json (7)
System\Text\Json\Document\JsonDocument.cs (3)
35public JsonElement RootElement => new JsonElement(this, 0); 174return new JsonElement(this, currentIndex + ((arrayIndex + 1) * DbRow.Size)); 184return new JsonElement(this, objectOffset);
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (2)
198value = new JsonElement(this, index + DbRow.Size); 216value = new JsonElement(this, index + DbRow.Size);
System\Text\Json\Document\JsonElement.ArrayEnumerator.cs (1)
42return new JsonElement(_target._parent, _curIdx);
System\Text\Json\Document\JsonElement.ObjectEnumerator.cs (1)
41return new JsonProperty(new JsonElement(_target._parent, _curIdx));
733 references to JsonElement
Aspire.Hosting.PostgreSQL.Tests (1)
AddPostgresTests.cs (1)
473var servers = document.RootElement.GetProperty("Servers");
Aspire.Hosting.Tests (1)
ManifestGenerationTests.cs (1)
195var verify = new List<Action<JsonElement>>();
Diagnostics.FunctionalTests (2)
DeveloperExceptionPageSampleTest.cs (2)
54var exceptionNode = (JsonElement)body.Extensions["exception"];
dotnet-openapi (1)
Commands\BaseCommand.cs (1)
464var packageVersionsElement = packageVersionDocument.RootElement.GetProperty("Packages");
dotnet-user-jwts (8)
Helpers\DevJwtCliHelpers.cs (8)
66if (launchSettingsJson.RootElement.TryGetProperty("profiles", out var profiles)) 82static List<string> ExtractIISExpressUrlFromProfile(JsonElement rootElement) 84if (rootElement.TryGetProperty("iisSettings", out var iisSettings)) 86if (iisSettings.TryGetProperty("iisExpress", out var iisExpress)) 89if (iisExpress.TryGetProperty("applicationUrl", out var iisUrl)) 94if (iisExpress.TryGetProperty("sslPort", out var sslPort)) 108if (profile.Value.TryGetProperty("commandName", out var commandName)) 112if (profile.Value.TryGetProperty("applicationUrl", out var applicationUrl))
JwtBearerSample (1)
Startup.cs (1)
79var obj = json.RootElement;
Microsoft.AspNetCore.Authentication (4)
JsonDocumentAuthExtensions.cs (4)
14/// Gets a string property value from the specified <see cref="JsonElement"/>. 16/// <param name="element">The <see cref="JsonElement"/>.</param> 19public static string? GetString(this JsonElement element, string key) 21if (element.TryGetProperty(key, out var property) && property.ValueKind != JsonValueKind.Null)
Microsoft.AspNetCore.Authentication.OAuth (24)
ClaimAction.cs (1)
42public abstract void Run(JsonElement userData, ClaimsIdentity identity, string issuer);
ClaimActionCollectionMapExtensions.cs (2)
82public static void MapCustomJson(this ClaimActionCollection collection, string claimType, Func<JsonElement, string?> resolver) 97public static void MapCustomJson(this ClaimActionCollection collection, string claimType, string valueType, Func<JsonElement, string?> resolver)
CustomJsonClaimAction.cs (3)
20public CustomJsonClaimAction(string claimType, string valueType, Func<JsonElement, string?> resolver) 29public Func<JsonElement, string?> Resolver { get; } 32public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer)
DeleteClaimAction.cs (1)
25public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer)
Events\OAuthCreatingTicketContext.cs (4)
36JsonElement user) 51/// <see cref="JsonElement"/> if it is not available. 53public JsonElement User { get; } 113public void RunClaimActions(JsonElement userData)
JsonKeyClaimAction.cs (3)
33public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer) 35if (!userData.TryGetProperty(JsonKey, out var value)) 41foreach (var v in value.EnumerateArray())
JsonSubKeyClaimAction.cs (5)
35public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer) 37if (!TryGetSubProperty(userData, JsonKey, SubKey, out var value)) 43foreach (var v in value.EnumerateArray()) 55private static bool TryGetSubProperty(JsonElement userData, string propertyName, string subProperty, out JsonElement value)
MapAllClaimsAction.cs (1)
23public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer)
OAuthTokenResponse.cs (4)
21var root = response.RootElement; 95var root = response.RootElement; 106if (root.TryGetProperty("error_description", out var errorDescription)) 112if (root.TryGetProperty("error_uri", out var errorUri))
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
UniqueJsonKeyClaimAction.cs (1)
30public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer)
Microsoft.AspNetCore.Authentication.Test (2)
JwtBearerTests.cs (1)
1001var expiresElement = dom.RootElement.GetProperty("expires");
JwtBearerTests_Handler.cs (1)
944var expiresElement = dom.RootElement.GetProperty("expires");
Microsoft.AspNetCore.Authentication.Twitter (5)
TwitterCreatingTicketContext.cs (3)
38JsonElement user) 72/// <see cref="JsonElement"/> if it is not available. 74public JsonElement User { get; }
TwitterHandler.cs (2)
147/// <param name="user">The <see cref="JsonElement"/> for the user.</param> 150ClaimsIdentity identity, AuthenticationProperties properties, AccessToken token, JsonElement user)
Microsoft.AspNetCore.Components.Endpoints.Tests (15)
EndpointHtmlRendererTest.cs (12)
143var rawValue = Assert.IsType<JsonElement>(value); 215var rawValue = Assert.IsType<JsonElement>(value); 480var rawValue = Assert.IsType<JsonElement>(value); 560var rawValue = Assert.IsType<JsonElement>(value); 1093var rawValue = Assert.IsType<JsonElement>(value); 1122var rawValue = Assert.IsType<JsonElement>(value);
src\Components\Shared\src\WebRootComponentParameters.cs (2)
51if (value is JsonElement jsonValue && otherValue is JsonElement otherJsonValue)
WebRootComponentParametersTest.cs (1)
179var jsonElement = JsonSerializer.SerializeToElement(parameterValues[i]);
Microsoft.AspNetCore.Components.Server (6)
BlazorPack\BlazorPackHubProtocolWorker.cs (2)
51else if (type == typeof(JsonElement)) 60return JsonElement.ParseValue(ref jsonReader);
Circuits\ComponentParameterDeserializer.cs (2)
64var value = (JsonElement)parameterValues[i];
src\Components\Shared\src\WebRootComponentParameters.cs (2)
51if (value is JsonElement jsonValue && otherValue is JsonElement otherJsonValue)
Microsoft.AspNetCore.Components.Server.Tests (2)
Circuits\CircuitHostTest.cs (1)
696var jsonElement = JsonSerializer.SerializeToElement(parameterValues[i]);
Circuits\RemoteRendererTest.cs (1)
693var jsonElement = JsonSerializer.SerializeToElement(parameterValues[i]);
Microsoft.AspNetCore.Components.Web (36)
JSComponents\JSComponentInterop.cs (2)
81protected internal void SetRootComponentParameters(int componentId, int parameterCount, JsonElement parametersJson, JsonSerializerOptions jsonOptions) 97var parameterJsonValue = jsonProperty.Value;
WebEventData\ChangeEventArgsReader.cs (5)
14internal static ChangeEventArgs Read(JsonElement jsonElement) 21var value = property.Value; 50private static string?[] GetJsonElementStringArrayValue(JsonElement jsonElement) 55foreach (var arrayElement in jsonElement.EnumerateArray()) 60$"Unsupported {nameof(JsonElement)} value kind '{arrayElement.ValueKind}' " +
WebEventData\ClipboardEventArgsReader.cs (1)
14internal static ClipboardEventArgs Read(JsonElement jsonElement)
WebEventData\DragEventArgsReader.cs (7)
21internal static DragEventArgs Read(JsonElement jsonElement) 39private static DataTransfer ReadDataTransfer(JsonElement jsonElement) 58var value = property.Value; 61foreach (var item in value.EnumerateArray()) 80private static DataTransferItem ReadDataTransferItem(JsonElement jsonElement) 102private static string[] ReadStringArray(JsonElement value) 106foreach (var item in value.EnumerateArray())
WebEventData\ErrorEventArgsReader.cs (1)
18internal static ErrorEventArgs Read(JsonElement jsonElement)
WebEventData\FocusEventArgsReader.cs (1)
14internal static FocusEventArgs Read(JsonElement jsonElement)
WebEventData\KeyboardEventArgsReader.cs (1)
23internal static KeyboardEventArgs Read(JsonElement jsonElement)
WebEventData\MouseEventArgsReader.cs (1)
31internal static MouseEventArgs Read(JsonElement jsonElement)
WebEventData\PointerEventArgsReader.cs (1)
21internal static PointerEventArgs Read(JsonElement jsonElement)
WebEventData\ProgressEventArgReader.cs (1)
17internal static ProgressEventArgs Read(JsonElement jsonElement)
WebEventData\TouchEventArgsReader.cs (4)
29internal static TouchEventArgs Read(JsonElement jsonElement) 79private static TouchPoint[] ReadTouchPointArray(JsonElement jsonElement) 83foreach (var item in jsonElement.EnumerateArray()) 91private static TouchPoint ReadTouchPoint(JsonElement jsonElement)
WebEventData\WebEventData.cs (5)
19JsonElement eventDescriptorJson, 20JsonElement eventArgsJson) 39JsonElement eventArgsJson) 68JsonElement eventArgsJson) 89JsonElement eventArgsJson,
WebEventData\WebEventDescriptorReader.cs (2)
19internal static WebEventDescriptor Read(JsonElement jsonElement) 45private static EventFieldInfo? ReadEventFieldInfo(JsonElement jsonElement)
WebEventData\WheelEventArgsReader.cs (1)
17internal static WheelEventArgs Read(JsonElement jsonElement)
WebRenderer.cs (3)
161public Task DispatchEventAsync(JsonElement eventDescriptor, JsonElement eventArgs) 175public void SetRootComponentParameters(int componentId, int parameterCount, JsonElement parametersJson)
Microsoft.AspNetCore.Components.Web.Tests (51)
WebEventData\ChangeEventArgsReaderTest.cs (6)
20var jsonElement = GetJsonElement(args); 37var jsonElement = GetJsonElement(args); 54var jsonElement = GetJsonElement(args); 63private static JsonElement GetJsonElement(ChangeEventArgs args) 67var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\ClipboardEventArgsReaderTest.cs (4)
18var jsonElement = GetJsonElement(args); 27private static JsonElement GetJsonElement(ClipboardEventArgs args) 31var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\DragEventArgsReaderTest.cs (4)
52var jsonElement = GetJsonElement(args); 81private static JsonElement GetJsonElement<T>(T args) 85var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\ErrorEventArgsReaderTest.cs (4)
23var jsonElement = GetJsonElement(args); 36private static JsonElement GetJsonElement<T>(T args) 40var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\FocusEventArgsReaderTest.cs (4)
19var jsonElement = GetJsonElement(args); 28private static JsonElement GetJsonElement<T>(T args) 32var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\KeyboardEventArgsReaderTest.cs (4)
28var jsonElement = GetJsonElement(args); 46private static JsonElement GetJsonElement<T>(T args) 50var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\MouseEventArgsReaderTest.cs (4)
35var jsonElement = GetJsonElement(args); 66private static JsonElement GetJsonElement<T>(T args) 70var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\PointerEventArgsReaderTest.cs (4)
41var jsonElement = GetJsonElement(args); 58private static JsonElement GetJsonElement<T>(T args) 62var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\ProgressEventArgsReaderTest.cs (4)
21var jsonElement = GetJsonElement(args); 33private static JsonElement GetJsonElement<T>(T args) 37var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\TouchEventArgsReaderTest.cs (4)
73var jsonElement = GetJsonElement(args); 111private static JsonElement GetJsonElement<T>(T args) 115var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\WebEventDescriptorReaderTest.cs (5)
25var jsonElement = GetJsonElement(args); 53var jsonElement = GetJsonElement(args); 65private static JsonElement GetJsonElement<T>(T args) 69var jsonElement = JsonElement.ParseValue(ref jsonReader);
WebEventData\WheelEventArgsReaderTest.cs (4)
38var jsonElement = GetJsonElement(args); 51private static JsonElement GetJsonElement<T>(T args) 55var jsonElement = JsonElement.ParseValue(ref jsonReader);
Microsoft.AspNetCore.Components.WebAssembly (5)
Infrastructure\WebAssemblyJsonSerializerContext.cs (1)
16[JsonSerializable(typeof(JsonElement))]
Prerendering\WebAssemblyComponentParameterDeserializer.cs (2)
59var value = (JsonElement)parameterValues[i];
src\Components\Shared\src\WebRootComponentParameters.cs (2)
51if (value is JsonElement jsonValue && otherValue is JsonElement otherJsonValue)
Microsoft.AspNetCore.Components.WebAssembly.Server (12)
TargetPickerUi.cs (12)
148var res = System.Text.Json.JsonDocument.Parse(await ReceiveMessageLoop(browserDebugClientConnect, token)).RootElement; 149var hasTabs = res.TryGetProperty("tabs", out var tabs); 150var hasType = res.TryGetProperty("type", out var type); 159var tabsList = tabs.Deserialize<JsonElement[]>(); 164foreach (var tab in tabsList) 166var hasUrl = tab.TryGetProperty("url", out var urlInTab); 167var hasActor = tab.TryGetProperty("actor", out var actorInTab); 168var hasBrowserId = tab.TryGetProperty("browserId", out var browserIdInTab); 209var hasInput = res.TryGetProperty("input", out var input); 221var hasTarget = res.TryGetProperty("target", out var target); 222JsonElement consoleActor = new(); 224var hasActor = res.TryGetProperty("actor", out var actor);
Microsoft.AspNetCore.Components.WebView (6)
IpcCommon.cs (6)
19public static bool TryDeserializeIncoming(string message, out IncomingMessageType messageType, out ArraySegment<JsonElement> args) 22public static bool TryDeserializeOutgoing(string message, out OutgoingMessageType messageType, out ArraySegment<JsonElement> args) 37private static bool TryDeserialize<T>(string message, out T messageType, out ArraySegment<JsonElement> args) 44var parsed = (JsonElement[])JsonSerializer.Deserialize(messageAfterPrefix, typeof(JsonElement[]), JsonSerializerOptionsProvider.Options); 46args = new ArraySegment<JsonElement>(parsed, 1, parsed.Length - 1);
Microsoft.AspNetCore.Diagnostics.Tests (10)
DeveloperExceptionPageMiddlewareTest.cs (9)
70var originalExceptionMessage = ((JsonElement)body.Extensions["OriginalExceptionMessage"]).GetString(); 123var originalExceptionMessage = ((JsonElement)body.Extensions["OriginalExceptionMessage"]).GetString(); 124var endpointDisplayName = ((JsonElement)body.Extensions["EndpointDisplayName"]).GetString(); 125var routeValue = ((JsonElement)body.Extensions["RouteValue"]).GetString(); 126var path = ((JsonElement)body.Extensions["Path"]).GetString(); 182var originalExceptionMessage = ((JsonElement)body.Extensions["OriginalExceptionMessage"]).GetString(); 183var endpointDisplayName = ((JsonElement)body.Extensions["EndpointDisplayName"]).GetString(); 184var routeValue = ((JsonElement)body.Extensions["RouteValue"]).GetString(); 185var path = ((JsonElement)body.Extensions["Path"]).GetString();
ExceptionHandlerMiddlewareTest.cs (1)
76var originalExceptionMessage = ((JsonElement)body.Extensions["OriginalExceptionMessage"]).GetString();
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Internal\Json\AnyConverter.cs (2)
24if (!d.RootElement.TryGetProperty(AnyTypeUrlField, out var urlField)) 45if (!d.RootElement.TryGetProperty(AnyWellKnownTypeValueField, out var valueField))
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (7)
ConverterTests\JsonElementComparer.cs (6)
9public class JsonElementComparer : IEqualityComparer<JsonElement> 24public bool Equals(JsonElement x, JsonElement y) 99public int GetHashCode(JsonElement obj) 106void ComputeHashCode(JsonElement obj, ref HashCode hash, int depth) 129foreach (var item in obj.EnumerateArray())
UnaryServerCallHandlerTests.cs (1)
1737var anyMessage = responseJson.RootElement.GetProperty("anyMessage");
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
HttpValidationProblemDetailsJsonConverterTest.cs (1)
41var errorsElement = document.RootElement.GetProperty("errors");
Microsoft.AspNetCore.Http.Extensions (1)
ProblemDetailsJsonContext.cs (1)
14[JsonSerializable(typeof(JsonElement))]
Microsoft.AspNetCore.Http.Extensions.Tests (3)
ProblemDetailsDefaultWriterTest.cs (3)
533var expectedExtension = JsonSerializer.SerializeToElement(customExtensionData, options.SerializerOptions); 534var value = Assert.IsType<JsonElement>(extension.Value);
Microsoft.AspNetCore.Identity.FunctionalTests (106)
MapIdentityApiTests.cs (106)
115var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 147var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 182var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 261var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 296var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 300var refreshContent = await refreshResponse.Content.ReadFromJsonAsync<JsonElement>(); 342var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 366var refreshContent = await refreshResponse.Content.ReadFromJsonAsync<JsonElement>(); 370refreshContent = await refreshResponse.Content.ReadFromJsonAsync<JsonElement>(); 415var refreshContent = await refreshResponse.Content.ReadFromJsonAsync<JsonElement>(); 672var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 691var twoFactorKeyContent = await twoFactorKeyResponse.Content.ReadFromJsonAsync<JsonElement>(); 703var enable2faContent = await enable2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 730var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 735var twoFactorKeyContent = await twoFactorKeyResponse.Content.ReadFromJsonAsync<JsonElement>(); 744var enable2faContent = await enable2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 757var recoveryLoginContent = await recoveryLoginResponse.Content.ReadFromJsonAsync<JsonElement>(); 764var disable2faContent = await disable2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 782var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 787var twoFactorKeyContent = await twoFactorKeyResponse.Content.ReadFromJsonAsync<JsonElement>(); 799var enable2faContent = await enable2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 803var resetKeyContent = await resetKeyResponse.Content.ReadFromJsonAsync<JsonElement>(); 816var reenable2faContent = await reenable2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 829var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>(); 834var twoFactorKeyContent = await twoFactorKeyResponse.Content.ReadFromJsonAsync<JsonElement>(); 843var enable2faContent = await enable2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 859var recoveryLoginContent = await recoveryLoginResponse.Content.ReadFromJsonAsync<JsonElement>(); 866var updated2faContent = await updated2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 874var resetRecoveryContent = await resetRecoveryResponse.Content.ReadFromJsonAsync<JsonElement>(); 900var twoFactorKeyContent = await twoFactorKeyResponse.Content.ReadFromJsonAsync<JsonElement>(); 912var enable2faContent = await enable2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 924var session2faContent = await session2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 933var session2faContent2 = await session2faResponse2.Content.ReadFromJsonAsync<JsonElement>(); 942var persistent2faContent = await persistent2faResponse.Content.ReadFromJsonAsync<JsonElement>(); 1039var infoResponse = await client.GetFromJsonAsync<JsonElement>("/identity/manage/info"); 1043var infoClaims = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1056var infoPostContent = await infoPostResponse.Content.ReadFromJsonAsync<JsonElement>(); 1062var infoPostClaims = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1083var infoAfterEmailChange = await client.GetFromJsonAsync<JsonElement>("/identity/manage/info"); 1088var claimsAfterEmailChange = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1099var infoAfterFinalLogin = await client.GetFromJsonAsync<JsonElement>("/identity/manage/info"); 1103var claimsAfterFinalLogin = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1135var infoResponse = await client.GetFromJsonAsync<JsonElement>("/identity/manage/info"); 1138var infoClaims = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1150var infoPostContent = await infoPostResponse.Content.ReadFromJsonAsync<JsonElement>(); 1155var infoPostClaims = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1172var infoAfterEmailChange = await client.GetFromJsonAsync<JsonElement>("/identity/manage/info"); 1177var claimsAfterEmailChange = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1185var infoAfterFinalLogin = await client.GetFromJsonAsync<JsonElement>("/identity/manage/info"); 1188var claimsAfterFinalLogin = await client.GetFromJsonAsync<JsonElement>("/auth/claims"); 1249var infoPostContent = await infoPostResponse.Content.ReadFromJsonAsync<JsonElement>(); 1268var infoGetContent = await client.GetFromJsonAsync<JsonElement>("/identity/manage/info"); 1355private static string? GetSingleClaim(JsonElement claims, string name) 1395var loginContent = await loginResponse.Content.ReadFromJsonAsync<JsonElement>();
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
ControllerEndpointFiltersTest.cs (3)
46Assert.True(((JsonElement)endpointFilterCalled).GetBoolean()); 59Assert.Equal("Index", ((JsonElement)methodInfo).GetString()); 84Assert.Equal("foobar", ((JsonElement)argument).GetString());
Microsoft.AspNetCore.Mvc.ViewFeatures (6)
Infrastructure\DefaultTempDataSerializer.cs (6)
21var rootElement = jsonDocument.RootElement; 25private static IDictionary<string, object> DeserializeDictionary(JsonElement rootElement) 80private static object DeserializeArray(in JsonElement arrayElement) 95foreach (var item in arrayElement.EnumerateArray()) 106foreach (var item in arrayElement.EnumerateArray()) 117private static object DeserializeDictionaryEntry(in JsonElement objectElement)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
HttpsTests.cs (1)
162var result = System.Text.Json.JsonDocument.Parse(response).RootElement;
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
HubConnectionTests.cs (1)
2008var features = await hubConnection.InvokeAsync<JsonElement[]>(nameof(TestHub.GetIHttpConnectionFeatureProperties)).DefaultTimeout();
Microsoft.AspNetCore.SignalR.Tests (2)
NativeAotTests.cs (2)
304await foreach (JsonElement item in source) 326await foreach (JsonElement item in source.ReadAllAsync())
Microsoft.Build (3)
Construction\Solution\SolutionFile.cs (3)
614_solutionFile = ParseSolutionFromSolutionFilter(solutionFilterFile, out JsonElement solution); 628foreach (JsonElement project in solution.GetProperty("projects").EnumerateArray()) 645internal static string ParseSolutionFromSolutionFilter(string solutionFilterFile, out JsonElement solution)
Microsoft.CodeAnalysis.EditorFeatures (8)
LanguageServer\AbstractInProcLanguageClient.cs (1)
39private readonly ILanguageClientMiddleLayer2<JsonElement>? _middleLayer = middleLayer;
LanguageServer\AbstractLanguageClientMiddleLayer.cs (7)
12internal abstract class AbstractLanguageClientMiddleLayer : ILanguageClientMiddleLayer2<JsonElement> 16public abstract Task HandleNotificationAsync(string methodName, JsonElement methodParam, Func<JsonElement, Task> sendNotification); 18public abstract Task<JsonElement> HandleRequestAsync(string methodName, JsonElement methodParam, Func<JsonElement, Task<JsonElement>> sendRequest);
Microsoft.CodeAnalysis.ExternalAccess.Razor (6)
RazorCSharpInterceptionMiddleLayer.cs (6)
30public override Task HandleNotificationAsync(string methodName, JsonElement methodParam, Func<JsonElement, Task> sendNotification) 36public override Task<JsonElement> HandleRequestAsync(string methodName, JsonElement methodParam, Func<JsonElement, Task<JsonElement>> sendRequest)
Microsoft.CodeAnalysis.ExternalAccess.Xaml (2)
External\ResolveDataConversions.cs (2)
24var resolveData = JsonSerializer.Deserialize<DataResolveData>((JsonElement)requestData); 38if (lspData is JsonElement token)
Microsoft.CodeAnalysis.Features (1)
PdbSourceDocument\SourceLinkMap.cs (1)
72var root = JsonDocument.Parse(json, new JsonDocumentOptions() { AllowTrailingCommas = true }).RootElement;
Microsoft.CodeAnalysis.LanguageServer.Protocol (28)
Handler\CodeActions\CodeActionFixAllResolveHandler.cs (1)
70var resolveData = JsonSerializer.Deserialize<CodeActionResolveData>((JsonElement)request.Data!, ProtocolConversions.LspJsonSerializerOptions);
Handler\CodeActions\CodeActionResolveHandler.cs (1)
101var resolveData = JsonSerializer.Deserialize<CodeActionResolveData>((JsonElement)request.Data!, ProtocolConversions.LspJsonSerializerOptions);
Handler\CodeLens\CodeLensResolveHandler.cs (1)
90var resolveData = JsonSerializer.Deserialize<CodeLensResolveData>((JsonElement)codeLens.Data, ProtocolConversions.LspJsonSerializerOptions);
Handler\Completion\CompletionResolveHandler.cs (1)
128var resolveData = JsonSerializer.Deserialize<DocumentResolveData>((JsonElement)request.Data);
Handler\Completion\Extensions.cs (1)
55var resolveData = JsonSerializer.Deserialize<CompletionResolveData>((JsonElement)request.Data, ProtocolConversions.LspJsonSerializerOptions);
Handler\Configuration\DidChangeConfigurationNotificationHandler_OnInitialized.cs (1)
18await _clientLanguageServerManager.SendRequestAsync<RegistrationParams, JsonElement>(
Handler\InlayHint\InlayHintResolveHandler.cs (1)
85var resolveData = JsonSerializer.Deserialize<InlayHintResolveData>((JsonElement)inlayHint.Data, ProtocolConversions.LspJsonSerializerOptions);
Protocol\Converters\NaturalObjectConverter.cs (1)
67return JsonSerializer.Deserialize<JsonElement>(ref reader);
Protocol\Converters\ParameterInformationConverter.cs (3)
19var root = document.RootElement; 23if (root.TryGetProperty("label", out var labelElement)) 35if (root.TryGetProperty("documentation", out var documentationElement))
Protocol\Converters\SumConverter.cs (1)
206if (document.RootElement.TryGetProperty(kindAttribute.KindPropertyName, out var value))
Protocol\Internal\Converters\ClassifiedTextRunConverter.cs (2)
19var data = JsonDocument.ParseValue(ref reader).RootElement; 20if (data.TryGetProperty(ObjectContentConverter.TypeProperty, out var typeProperty) && typeProperty.GetString() != nameof(ClassifiedTextRun))
Protocol\Internal\Converters\ImageIdConverter.cs (2)
20var root = document.RootElement; 21if (root.TryGetProperty(ObjectContentConverter.TypeProperty, out var typeProperty) && typeProperty.GetString() != nameof(ImageId))
Protocol\Internal\Converters\ObjectContentConverter.cs (1)
49var data = jsonDocument.RootElement;
RoslynLanguageServer.cs (5)
178var parameters = (JsonElement)serializedParameters; 195if (parameters.TryGetProperty("textDocument", out var textDocumentToken) || 198var uriToken = textDocumentToken.GetProperty("uri"); 202else if (parameters.TryGetProperty("data", out var dataToken))
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\SystemTextJsonLanguageServer.cs (6)
48var request = (JsonElement)serializedRequest; 75private Task<JsonElement?> ExecuteRequest0Async(CancellationToken cancellationToken = default) 83private async Task<JsonElement?> ExecuteRequestAsync(JsonElement? request, CancellationToken cancellationToken = default) 94var serializedResult = JsonSerializer.SerializeToElement(result, target._jsonSerializerOptions);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
CodeActions\CodeActionsTests.cs (2)
94r => JsonSerializer.Deserialize<CodeActionResolveData>((JsonElement)r.Data!, ProtocolConversions.LspJsonSerializerOptions)!.UniqueIdentifier == titlePath[1]); 324return JsonSerializer.Deserialize<CodeActionResolveData>((JsonElement)codeAction.Data!, ProtocolConversions.LspJsonSerializerOptions);
Diagnostics\DiagnosticRegistrationTests.cs (1)
56.Select(r => JsonSerializer.Deserialize<DiagnosticRegistrationOptions>((JsonElement)r.RegisterOptions!, ProtocolConversions.LspJsonSerializerOptions)!);
References\FindAllReferencesHandlerTests.cs (1)
354.SelectMany(r => (List<object>)r).Select(r => JsonSerializer.Deserialize<T>((JsonElement)r, ProtocolConversions.LspJsonSerializerOptions))
Microsoft.CodeAnalysis.LanguageServer.UnitTests (2)
LspFileChangeWatcherTests.cs (2)
112var registrationJson = Assert.IsType<JsonElement>(Assert.Single(dynamicCapabilities.Registrations).Value.RegisterOptions);
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
MSBuild\MSBuildProjectLoader.SolutionFilterReader.cs (2)
28var solution = document.RootElement.GetProperty("solution"); 57foreach (var project in solution.GetProperty("projects").EnumerateArray())
Microsoft.CommonLanguageServerProtocol.Framework.Package (6)
SystemTextJsonLanguageServer.cs (6)
48var request = (JsonElement)serializedRequest; 75private Task<JsonElement?> ExecuteRequest0Async(CancellationToken cancellationToken = default) 83private async Task<JsonElement?> ExecuteRequestAsync(JsonElement? request, CancellationToken cancellationToken = default) 94var serializedResult = JsonSerializer.SerializeToElement(result, target._jsonSerializerOptions);
Microsoft.DotNet.Arcade.Sdk (3)
src\InstallDotNetCore.cs (3)
61if (jsonDocument.RootElement.TryGetProperty("tools", out JsonElement toolsElement)) 63if (toolsElement.TryGetProperty("runtimes", out JsonElement dotnetLocalElement)) 225foreach (var version in token.Value.EnumerateArray())
Microsoft.Extensions.AI (15)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (4)
125var schemaElement = AIJsonUtilities.CreateJsonSchema( 131JsonElement schema; 199private static bool SchemaRepresentsObject(JsonElement schemaElement) 216private static JsonNode? JsonElementToJsonNode(JsonElement element)
ChatCompletion\ChatCompletion{T}.cs (1)
145if (JsonDocument.Parse(json!).RootElement.TryGetProperty("data", out var data))
Functions\AIFunctionFactory.cs (10)
39/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="options"/>'s 42/// <see cref="AIFunctionFactoryCreateOptions.SerializerOptions"/>. If the argument is a <see cref="JsonElement"/>, 69/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="serializerOptions"/>. 71/// <paramref name="serializerOptions"/>. If the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>, 111/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="options"/>'s 114/// <see cref="AIFunctionFactoryCreateOptions.SerializerOptions"/>. If the argument is a <see cref="JsonElement"/>, 147/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="serializerOptions"/>. 149/// <paramref name="serializerOptions"/>. If the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>, 330return JsonElement.ParseValue(ref reader); 381JsonElement element => JsonSerializer.Deserialize(element, typeInfo),
Microsoft.Extensions.AI.Abstractions (19)
ChatCompletion\ChatResponseFormat.cs (1)
35JsonElement schema, string? schemaName = null, string? schemaDescription = null) =>
ChatCompletion\ChatResponseFormatJson.cs (2)
21JsonElement? schema, string? schemaName = null, string? schemaDescription = null) 36public JsonElement? Schema { get; }
Utilities\AIJsonUtilities.Defaults.cs (1)
65[JsonSerializable(typeof(JsonElement))]
Utilities\AIJsonUtilities.Schema.cs (15)
37private static readonly ConditionalWeakTable<JsonSerializerOptions, ConcurrentDictionary<SchemaGenerationKey, JsonElement>> _schemaCaches = new(); 40private static readonly JsonElement _trueJsonSchema = ParseJsonElement("true"u8); 43private static readonly JsonElement _nullJsonSchema = ParseJsonElement("""{"type":"null"}"""u8); 56/// <returns>A JSON schema document encoded as a <see cref="JsonElement"/>.</returns> 57public static JsonElement ResolveParameterJsonSchema( 69parameterMetadata.Schema is JsonElement schema) 96/// <returns>A JSON schema document encoded as a <see cref="JsonElement"/>.</returns> 101public static JsonElement CreateParameterJsonSchema( 133/// <returns>A <see cref="JsonElement"/> representing the schema.</returns> 138public static JsonElement CreateJsonSchema( 160private static JsonElement GetJsonSchemaCached(JsonSerializerOptions options, SchemaGenerationKey key) 163ConcurrentDictionary<SchemaGenerationKey, JsonElement> cache = _schemaCaches.GetOrCreateValue(options); 185private static JsonElement GetJsonSchemaCore(JsonSerializerOptions options, SchemaGenerationKey key) 438private static JsonElement ParseJsonElement(ReadOnlySpan<byte> utf8Json) 441return JsonElement.ParseValue(ref reader);
Microsoft.Extensions.AI.Abstractions.Tests (46)
AssertExtensions.cs (5)
58JsonElement expectedElement = NormalizeToElement(expected, options); 59JsonElement actualElement = NormalizeToElement(actual, options); 60if (!JsonElement.DeepEquals(expectedElement, actualElement)) 69static JsonElement NormalizeToElement(object? value, JsonSerializerOptions options) 70=> value is JsonElement e ? e : JsonSerializer.SerializeToElement(value, options);
ChatCompletion\ChatCompletionTests.cs (2)
167Assert.IsType<JsonElement>(value); 168Assert.Equal("value", ((JsonElement)value!).GetString());
ChatCompletion\ChatOptionsTests.cs (2)
168Assert.IsType<JsonElement>(value); 169Assert.Equal("value", ((JsonElement)value!).GetString());
ChatCompletion\ChatResponseFormatTests.cs (2)
12private static JsonElement EmptySchema => JsonDocument.Parse("{}").RootElement; 74ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("[1,2,3]"), "name", "description"),
ChatCompletion\StreamingChatCompletionUpdateTests.cs (2)
217Assert.IsType<JsonElement>(value); 218Assert.Equal("value", ((JsonElement)value!).GetString());
Contents\FunctionCallContentTests..cs (5)
133Assert.All(arguments.Values, v => Assert.IsType<JsonElement>(v)); 289Assert.True(kvp.Value is JsonElement { ValueKind: JsonValueKind.Object }); 299Assert.True(kvp.Value is JsonElement { ValueKind: JsonValueKind.Array }); 304Assert.True(kvp.Value is JsonElement { ValueKind: JsonValueKind.Number }); 309Assert.True(kvp.Value is JsonElement { ValueKind: JsonValueKind.True });
Embeddings\EmbeddingGenerationOptionsTests.cs (2)
83Assert.IsType<JsonElement>(value); 84Assert.Equal("value", ((JsonElement)value!).GetString());
test\Shared\JsonSchemaExporter\TestTypes.cs (4)
101yield return new TestData<JsonElement>(JsonDocument.Parse("""[{ "x" : 42 }]""").RootElement, "true"); 117yield return new TestData<JsonElement?>(JsonDocument.Parse("{}").RootElement, "true"); 1226[JsonSerializable(typeof(JsonElement))] 1240[JsonSerializable(typeof(JsonElement?))]
Utilities\AIJsonUtilitiesTests.cs (22)
54JsonElement expected = JsonDocument.Parse(""" 77JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(MyPoco), serializerOptions: JsonSerializerOptions.Default); 79Assert.True(JsonElement.DeepEquals(expected, actual)); 85JsonElement expected = JsonDocument.Parse(""" 116JsonElement actual = AIJsonUtilities.CreateJsonSchema( 124Assert.True(JsonElement.DeepEquals(expected, actual)); 130JsonElement expected = JsonDocument.Parse(""" 167JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(MyPoco), serializerOptions: JsonSerializerOptions.Default, inferenceOptions: inferenceOptions); 169Assert.True(JsonElement.DeepEquals(expected, actual)); 175JsonElement expected = JsonDocument.Parse(""" 195JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(PocoWithTypesWithOpenAIUnsupportedKeywords), serializerOptions: JsonSerializerOptions.Default); 197Assert.True(JsonElement.DeepEquals(expected, actual)); 220JsonElement generatedSchema = Assert.IsType<JsonElement>(param.Schema); 222JsonElement resolvedSchema; 224Assert.True(JsonElement.DeepEquals(generatedSchema, resolvedSchema)); 230JsonElement expected = JsonDocument.Parse(""" 242JsonElement actualSchema = Assert.IsType<JsonElement>(param.Schema); 243Assert.True(JsonElement.DeepEquals(expected, actualSchema)); 260JsonElement schema = AIJsonUtilities.CreateJsonSchema(typeof(object)); 279JsonElement schema = AIJsonUtilities.CreateJsonSchema(testData.Type, serializerOptions: options, inferenceOptions: createOptions);
Microsoft.Extensions.AI.AzureAIInference (3)
AzureAIChatToolJson.cs (1)
24public Dictionary<string, JsonElement> Properties { get; set; } = [];
AzureAIInferenceChatClient.cs (2)
28private static readonly JsonElement _defaultParameterSchema = JsonDocument.Parse("{}").RootElement; 390parameter.Schema is JsonElement schema ? schema : _defaultParameterSchema);
Microsoft.Extensions.AI.AzureAIInference.Tests (6)
AzureAIInferenceChatClientTests.cs (1)
409ResponseFormat = ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("""
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (5)
58JsonElement expectedElement = NormalizeToElement(expected, options); 59JsonElement actualElement = NormalizeToElement(actual, options); 60if (!JsonElement.DeepEquals(expectedElement, actualElement)) 69static JsonElement NormalizeToElement(object? value, JsonSerializerOptions options) 70=> value is JsonElement e ? e : JsonSerializer.SerializeToElement(value, options);
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
138if (kvp.Value is JsonElement jsonElement)
Microsoft.Extensions.AI.Ollama (9)
OllamaChatClient.cs (5)
25private static readonly JsonElement _defaultParameterSchema = JsonDocument.Parse("{}").RootElement; 26private static readonly JsonElement _schemalessJsonResponseFormatValue = JsonDocument.Parse("\"json\"").RootElement; 266private static JsonElement? ToOllamaChatResponseFormat(ChatResponseFormat? format) 434JsonElement jsonResult = JsonSerializer.SerializeToElement(frc.Result, ToolCallJsonSerializerOptions.GetTypeInfo(typeof(object))); 466p => p.Schema is JsonElement e ? e : _defaultParameterSchema),
OllamaChatRequest.cs (1)
13public JsonElement? Format { get; set; }
OllamaFunctionCallContent.cs (1)
12public JsonElement Arguments { get; set; }
OllamaFunctionResultContent.cs (1)
11public JsonElement Result { get; set; }
OllamaFunctionToolParameters.cs (1)
12public required IDictionary<string, JsonElement> Properties { get; set; }
Microsoft.Extensions.AI.Ollama.Tests (5)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (5)
58JsonElement expectedElement = NormalizeToElement(expected, options); 59JsonElement actualElement = NormalizeToElement(actual, options); 60if (!JsonElement.DeepEquals(expectedElement, actualElement)) 69static JsonElement NormalizeToElement(object? value, JsonSerializerOptions options) 70=> value is JsonElement e ? e : JsonSerializer.SerializeToElement(value, options);
Microsoft.Extensions.AI.OpenAI (10)
OpenAIModelMapper.ChatCompletion.cs (6)
24private static readonly JsonElement _defaultParameterSchema = JsonDocument.Parse("{}").RootElement; 209JsonElement jsonElement = toolChoiceJson.RootElement; 221if (jsonElement.TryGetProperty("function", out JsonElement functionElement)) 355foreach (KeyValuePair<string, JsonElement> property in openAiChatTool.Properties) 403tool.Properties.Add(parameter.Name, parameter.Schema is JsonElement e ? e : _defaultParameterSchema); 600public Dictionary<string, JsonElement> Properties { get; set; } = [];
OpenAIRealtimeExtensions.cs (4)
21private static readonly JsonElement _defaultParameterSchema = JsonDocument.Parse("{}").RootElement; 98private static JsonElement GetParameterSchema(AIFunctionParameterMetadata parameterMetadata) 102{ Schema: JsonElement jsonElement } => jsonElement, 153public IDictionary<string, JsonElement>? Properties { get; set; }
Microsoft.Extensions.AI.OpenAI.Tests (8)
OpenAISerializationTests.cs (3)
344Assert.Equal("{}", Assert.IsType<JsonElement>(function.Metadata.ReturnParameter.Schema).GetRawText()); 350JsonObject parameterSchema = Assert.IsType<JsonObject>(JsonNode.Parse(Assert.IsType<JsonElement>(parameter.Schema).GetRawText())); 426Assert.Equal(42, Assert.IsType<JsonElement>(frc.Result).GetInt32());
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (5)
58JsonElement expectedElement = NormalizeToElement(expected, options); 59JsonElement actualElement = NormalizeToElement(actual, options); 60if (!JsonElement.DeepEquals(expectedElement, actualElement)) 69static JsonElement NormalizeToElement(object? value, JsonSerializerOptions options) 70=> value is JsonElement e ? e : JsonSerializer.SerializeToElement(value, options);
Microsoft.Extensions.AI.Tests (6)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (5)
58JsonElement expectedElement = NormalizeToElement(expected, options); 59JsonElement actualElement = NormalizeToElement(actual, options); 60if (!JsonElement.DeepEquals(expectedElement, actualElement)) 69static JsonElement NormalizeToElement(object? value, JsonSerializerOptions options) 70=> value is JsonElement e ? e : JsonSerializer.SerializeToElement(value, options);
TestJsonSerializerContext.cs (1)
20[JsonSerializable(typeof(JsonElement))]
Microsoft.Extensions.Configuration.Json (4)
JsonConfigurationFileParser.cs (4)
43private void VisitObjectElement(JsonElement element) 58private void VisitArrayElement(JsonElement element) 62foreach (JsonElement arrayElement in element.EnumerateArray()) 81private void VisitValue(JsonElement value)
Microsoft.JSInterop.Tests (3)
Infrastructure\DotNetDispatcherTest.cs (3)
131var root = result.RootElement; 140var resultDto2Ref = root[1]; 144Assert.True(resultDto2Ref.TryGetProperty(DotNetDispatcher.DotNetObjectRefKey.EncodedUtf8Bytes, out var property));
Microsoft.ML.GenAI.Phi (4)
Module\Phi3SuScaledRotaryEmbedding.cs (4)
28JsonElement shortFactorElement = (JsonElement)config.RopeScaling!["short_factor"]; 29JsonElement longFactorDocument = (JsonElement)config.RopeScaling!["long_factor"];
Negotiate.Client (2)
Controllers\AuthTestController.cs (2)
284var details = JsonDocument.Parse(body).RootElement; 304var details = JsonDocument.Parse(body).RootElement;
OpenIdConnectSample (2)
Startup.cs (2)
269if (payload.RootElement.TryGetProperty("expires_in", out var property) && int.TryParse(property.GetString(), out var seconds)) 365public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer)
Shared (1)
JsonSchemaExporter\JsonSchemaExporter.cs (1)
629[typeof(JsonElement)] = _ => JsonSchema.CreateTrueSchema(),
Shared.Tests (4)
JsonSchemaExporter\TestTypes.cs (4)
101yield return new TestData<JsonElement>(JsonDocument.Parse("""[{ "x" : 42 }]""").RootElement, "true"); 117yield return new TestData<JsonElement?>(JsonDocument.Parse("{}").RootElement, "true"); 1226[JsonSerializable(typeof(JsonElement))] 1240[JsonSerializable(typeof(JsonElement?))]
SocialSample (2)
Startup.cs (2)
343if (payload.RootElement.TryGetProperty("expires_in", out var property) && property.TryGetInt32(out var seconds)) 373if (payload.RootElement.TryGetProperty("expires_in", out var property) && property.TryGetInt32(out var seconds))
System.Text.Json (182)
System\Runtime\InteropServices\JsonMarshal.cs (2)
14/// Gets a <see cref="ReadOnlySpan{T}"/> view over the raw JSON data of the given <see cref="JsonElement"/>. 25public static ReadOnlySpan<byte> GetRawUtf8Value(JsonElement element)
System\Text\Json\Document\JsonDocument.cs (5)
33/// The <see cref="JsonElement"/> representing the value of the document. 35public JsonElement RootElement => new JsonElement(this, 0); 99/// This <see cref="RootElement"/>'s <see cref="JsonElement.ValueKind"/> would result in an invalid JSON. 154internal JsonElement GetArrayIndexElement(int currentIndex, int arrayIndex) 779internal JsonElement CloneElement(int index)
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (3)
11internal bool TryGetNamedPropertyValue(int index, ReadOnlySpan<char> propertyName, out JsonElement value) 111internal bool TryGetNamedPropertyValue(int index, ReadOnlySpan<byte> propertyName, out JsonElement value) 139out JsonElement value)
System\Text\Json\Document\JsonElement.ArrayEnumerator.cs (7)
16public struct ArrayEnumerator : IEnumerable<JsonElement>, IEnumerator<JsonElement> 18private readonly JsonElement _target; 22internal ArrayEnumerator(JsonElement target) 33public JsonElement Current 64IEnumerator<JsonElement> IEnumerable<JsonElement>.GetEnumerator() => GetEnumerator();
System\Text\Json\Document\JsonElement.cs (27)
62public JsonElement this[int index] 107/// Gets a <see cref="JsonElement"/> representing the value of a required property identified 118/// A <see cref="JsonElement"/> representing the value of the requested property. 133public JsonElement GetProperty(string propertyName) 140if (TryGetProperty(propertyName, out JsonElement property)) 149/// Gets a <see cref="JsonElement"/> representing the value of a required property identified 164/// A <see cref="JsonElement"/> representing the value of the requested property. 176public JsonElement GetProperty(ReadOnlySpan<char> propertyName) 178if (TryGetProperty(propertyName, out JsonElement property)) 187/// Gets a <see cref="JsonElement"/> representing the value of a required property identified 204/// A <see cref="JsonElement"/> representing the value of the requested property. 216public JsonElement GetProperty(ReadOnlySpan<byte> utf8PropertyName) 218if (TryGetProperty(utf8PropertyName, out JsonElement property)) 256public bool TryGetProperty(string propertyName, out JsonElement value) 293public bool TryGetProperty(ReadOnlySpan<char> propertyName, out JsonElement value) 329public bool TryGetProperty(ReadOnlySpan<byte> utf8PropertyName, out JsonElement value) 1243/// Compares the values of two <see cref="JsonElement"/> values for equality, including the values of all descendant elements. 1245/// <param name="element1">The first <see cref="JsonElement"/> to compare.</param> 1246/// <param name="element2">The second <see cref="JsonElement"/> to compare.</param> 1263public static bool DeepEquals(JsonElement element1, JsonElement element2) 1309foreach (JsonElement e1 in element1.EnumerateArray()) 1373Dictionary<string, ValueQueue<JsonElement>> properties2 = new(capacity: remainingProps, StringComparer.Ordinal); 1378ref ValueQueue<JsonElement> values = ref CollectionsMarshal.GetValueRefOrAddDefault(properties2, prop2.Name, out bool _); 1393ref ValueQueue<JsonElement> values = ref CollectionsMarshal.GetValueRefOrAddDefault(properties2, prop.Name, out bool exists); 1397if (!exists || !values.TryDequeue(out JsonElement value) || !DeepEquals(prop.Value, value)) 1697public JsonElement Clone()
System\Text\Json\Document\JsonElement.ObjectEnumerator.cs (2)
18private readonly JsonElement _target; 22internal ObjectEnumerator(JsonElement target)
System\Text\Json\Document\JsonElement.Parse.cs (5)
47public static JsonElement ParseValue(ref Utf8JsonReader reader) 56internal static JsonElement ParseValue(Stream utf8Json, JsonDocumentOptions options) 62internal static JsonElement ParseValue(ReadOnlySpan<byte> utf8Json, JsonDocumentOptions options) 68internal static JsonElement ParseValue(string json, JsonDocumentOptions options) 112public static bool TryParseValue(ref Utf8JsonReader reader, [NotNullWhen(true)] out JsonElement? element)
System\Text\Json\Document\JsonProperty.cs (3)
18public JsonElement Value { get; } 21internal JsonProperty(JsonElement value) 110/// This <see cref="Value"/>'s <see cref="JsonElement.ValueKind"/> would result in an invalid JSON.
System\Text\Json\Nodes\JsonArray.cs (13)
23private JsonElement? _jsonElement; 26internal override JsonElement? UnderlyingElement => _jsonElement; 76GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 183/// Initializes a new instance of the <see cref="JsonArray"/> class that contains items from the specified <see cref="JsonElement"/>. 186/// The new instance of the <see cref="JsonArray"/> class that contains items from the specified <see cref="JsonElement"/>. 188/// <param name="element">The <see cref="JsonElement"/>.</param> 193public static JsonArray? Create(JsonElement element, JsonNodeOptions? options = null) 203internal JsonArray(JsonElement element, JsonNodeOptions? options = null) : base(options) 271GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 299GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 305JsonElement jElement = jsonElement.Value; 310foreach (JsonElement element in jElement.EnumerateArray()) 335private void GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement)
System\Text\Json\Nodes\JsonNode.cs (6)
26internal virtual JsonElement? UnderlyingElement => null; 183/// If the underlying value is a <see cref="JsonElement"/> then {T} can also be the type of any primitive 184/// value supported by current <see cref="JsonElement"/>. 186/// The underlying value of a <see cref="JsonValue"/> after deserialization is an instance of <see cref="JsonElement"/>, 367/// to support arbitrary <see cref="JsonElement"/> and <see cref="JsonNode"/> values. 384if (value is JsonElement element)
System\Text\Json\Nodes\JsonNode.Parse.cs (8)
51JsonElement element = JsonElement.ParseValue(ref reader); 80JsonElement element = JsonElement.ParseValue(json, documentOptions); 101JsonElement element = JsonElement.ParseValue(utf8Json, documentOptions); 128JsonElement element = JsonElement.ParseValue(utf8Json, documentOptions);
System\Text\Json\Nodes\JsonObject.cs (9)
21private JsonElement? _jsonElement; 23internal override JsonElement? UnderlyingElement => _jsonElement; 51/// Initializes a new instance of the <see cref="JsonObject"/> class that contains properties from the specified <see cref="JsonElement"/>. 54/// The new instance of the <see cref="JsonObject"/> class that contains properties from the specified <see cref="JsonElement"/>. 56/// <param name="element">The <see cref="JsonElement"/>.</param> 59public static JsonObject? Create(JsonElement element, JsonNodeOptions? options = null) 69internal JsonObject(JsonElement element, JsonNodeOptions? options = null) : this(options) 85GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 139GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement);
System\Text\Json\Nodes\JsonObject.IDictionary.cs (2)
221GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 263private void GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement)
System\Text\Json\Nodes\JsonValue.CreateOverloads.cs (3)
290public static JsonValue? Create(JsonElement value, JsonNodeOptions? options = null) => JsonValue.CreateFromElement(ref value, options); 298public static JsonValue? Create(JsonElement? value, JsonNodeOptions? options = null) => value is JsonElement element ? JsonValue.CreateFromElement(ref element, options) : null;
System\Text\Json\Nodes\JsonValue.cs (10)
26/// If the underlying value is a <see cref="JsonElement"/> then {T} can also be the type of any primitive 27/// value supported by current <see cref="JsonElement"/>. 29/// The underlying value of a <see cref="JsonValue"/> after deserialization is an instance of <see cref="JsonElement"/>, 62if (value is JsonElement element) 101if (value is JsonElement element && jsonTypeInfo.EffectiveConverter.IsInternalConverter) 117JsonElement thisElement = ToJsonElement(this, out JsonDocument? thisDocument); 118JsonElement otherElement = ToJsonElement(otherNode, out JsonDocument? otherDocument); 121return JsonElement.DeepEquals(thisElement, otherElement); 129static JsonElement ToJsonElement(JsonNode node, out JsonDocument? backingDocument) 181internal static JsonValue? CreateFromElement(ref readonly JsonElement element, JsonNodeOptions? options = null)
System\Text\Json\Nodes\JsonValueOfElement.cs (6)
10/// Defines a primitive JSON value that is wrapping a <see cref="JsonElement"/>. 12internal sealed class JsonValueOfElement : JsonValue<JsonElement> 14public JsonValueOfElement(JsonElement value, JsonNodeOptions? options) : base(value, options) 19internal override JsonElement? UnderlyingElement => Value; 25if (otherNode.UnderlyingElement is JsonElement otherElement) 27return JsonElement.DeepEquals(Value, otherElement);
System\Text\Json\Nodes\JsonValueOfT.cs (2)
18Debug.Assert(value is not JsonElement or JsonElement { ValueKind: not JsonValueKind.Null });
System\Text\Json\Serialization\Attributes\JsonExtensionDataAttribute.cs (4)
13/// and TValue must be <see cref="JsonElement"/> or <see cref="object"/>. 17/// <see cref="JsonElement"/> depending on the value of <see cref="System.Text.Json.JsonSerializerOptions.UnknownTypeHandling"/>. 19/// If a <see cref="JsonElement"/> is created, a "null" JSON value is treated as a JsonElement with <see cref="JsonElement.ValueKind"/>
System\Text\Json\Serialization\Converters\Node\JsonArrayConverter.cs (2)
39JsonElement jElement = JsonElement.ParseValue(ref reader);
System\Text\Json\Serialization\Converters\Node\JsonNodeConverter.cs (1)
60public static JsonNode? Create(JsonElement element, JsonNodeOptions? options)
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (2)
64JsonElement jElement = JsonElement.ParseValue(ref reader);
System\Text\Json\Serialization\Converters\Node\JsonValueConverter.cs (2)
30JsonElement element = JsonElement.ParseValue(ref reader);
System\Text\Json\Serialization\Converters\Object\ObjectConverter.cs (3)
104return JsonElement.ParseValue(ref reader); 117JsonElement element = JsonElement.ParseValue(ref reader);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (2)
241if (extDictionary is IDictionary<string, JsonElement> dict) 243dict[dataExtKey] = (JsonElement)propValue!;
System\Text\Json\Serialization\Converters\Value\JsonElementConverter.cs (4)
9internal sealed class JsonElementConverter : JsonConverter<JsonElement> 11public override JsonElement Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 13return JsonElement.ParseValue(ref reader); 16public override void Write(Utf8JsonWriter writer, JsonElement value, JsonSerializerOptions options)
System\Text\Json\Serialization\JsonSerializer.Read.Element.cs (15)
13/// Converts the <see cref="JsonElement"/> representing a single JSON value into a <typeparamref name="TValue"/>. 17/// <param name="element">The <see cref="JsonElement"/> to convert.</param> 28public static TValue? Deserialize<TValue>(this JsonElement element, JsonSerializerOptions? options = null) 36/// Converts the <see cref="JsonElement"/> representing a single JSON value into a <paramref name="returnType"/>. 39/// <param name="element">The <see cref="JsonElement"/> to convert.</param> 54public static object? Deserialize(this JsonElement element, Type returnType, JsonSerializerOptions? options = null) 67/// Converts the <see cref="JsonElement"/> representing a single JSON value into a <typeparamref name="TValue"/>. 71/// <param name="element">The <see cref="JsonElement"/> to convert.</param> 83public static TValue? Deserialize<TValue>(this JsonElement element, JsonTypeInfo<TValue> jsonTypeInfo) 96/// Converts the <see cref="JsonElement"/> representing a single JSON value into an instance specified by the <paramref name="jsonTypeInfo"/>. 99/// <param name="element">The <see cref="JsonElement"/> to convert.</param> 104public static object? Deserialize(this JsonElement element, JsonTypeInfo jsonTypeInfo) 117/// Converts the <see cref="JsonElement"/> representing a single JSON value into a <paramref name="returnType"/>. 120/// <param name="element">The <see cref="JsonElement"/> to convert.</param> 148public static object? Deserialize(this JsonElement element, Type returnType, JsonSerializerContext context)
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (1)
352JsonElement element,
System\Text\Json\Serialization\JsonSerializer.Read.HandlePropertyName.cs (1)
125genericArgs[1].UnderlyingSystemType == typeof(JsonElement) ||
System\Text\Json\Serialization\JsonSerializer.Write.Element.cs (19)
14/// Converts the provided value into a <see cref="JsonElement"/>. 17/// <returns>A <see cref="JsonElement"/> representation of the JSON value.</returns> 26public static JsonElement SerializeToElement<TValue>(TValue value, JsonSerializerOptions? options = null) 33/// Converts the provided value into a <see cref="JsonElement"/>. 35/// <returns>A <see cref="JsonElement"/> representation of the value.</returns> 51public static JsonElement SerializeToElement(object? value, Type inputType, JsonSerializerOptions? options = null) 59/// Converts the provided value into a <see cref="JsonElement"/>. 62/// <returns>A <see cref="JsonElement"/> representation of the value.</returns> 68public static JsonElement SerializeToElement<TValue>(TValue value, JsonTypeInfo<TValue> jsonTypeInfo) 80/// Converts the provided value into a <see cref="JsonElement"/>. 82/// <returns>A <see cref="JsonElement"/> representation of the value.</returns> 91public static JsonElement SerializeToElement(object? value, JsonTypeInfo jsonTypeInfo) 103/// Converts the provided value into a <see cref="JsonElement"/>. 105/// <returns>A <see cref="JsonElement"/> representation of the value.</returns> 120public static JsonElement SerializeToElement(object? value, Type inputType, JsonSerializerContext context) 132private static JsonElement WriteElement<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo) 142return JsonElement.ParseValue(output.WrittenMemory.Span, options.GetDocumentOptions()); 150private static JsonElement WriteElementAsObject(object? value, JsonTypeInfo jsonTypeInfo) 160return JsonElement.ParseValue(output.WrittenMemory.Span, options.GetDocumentOptions());
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
136/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonElement"/> values. 139public static JsonConverter<JsonElement> JsonElementConverter => s_jsonElementConverter ??= new JsonElementConverter(); 140private static JsonConverter<JsonElement>? s_jsonElementConverter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (10)
869else if (propValue is IDictionary<string, JsonElement> dictionaryElementValue) 871JsonConverter<JsonElement> converter = GetDictionaryValueConverter<JsonElement>(); 872JsonElement value = converter.Read(ref reader, typeof(JsonElement), Options); 912JsonConverter<JsonElement> converter = (JsonConverter<JsonElement>)Options.GetConverterInternal(typeof(JsonElement)); 913if (!converter.TryRead(ref reader, typeof(JsonElement), Options, ref state, out JsonElement jsonElement, out _))
Templates.Blazor.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
321var profiles = launchSettings.RootElement.GetProperty("profiles"); 335var applicationUrl = actualProfile.Value.GetProperty("applicationUrl");
Templates.Blazor.WebAssembly.Auth.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
321var profiles = launchSettings.RootElement.GetProperty("profiles"); 335var applicationUrl = actualProfile.Value.GetProperty("applicationUrl");
Templates.Blazor.WebAssembly.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
321var profiles = launchSettings.RootElement.GetProperty("profiles"); 335var applicationUrl = actualProfile.Value.GetProperty("applicationUrl");
Templates.Mvc.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
321var profiles = launchSettings.RootElement.GetProperty("profiles"); 335var applicationUrl = actualProfile.Value.GetProperty("applicationUrl");
Templates.Tests (2)
src\ProjectTemplates\Shared\Project.cs (2)
321var profiles = launchSettings.RootElement.GetProperty("profiles"); 335var applicationUrl = actualProfile.Value.GetProperty("applicationUrl");