7 types derived from JsonNode
System.Text.Json (7)
System\Text\Json\Nodes\JsonArray.cs (1)
21public sealed partial class JsonArray : JsonNode
System\Text\Json\Nodes\JsonArray.IList.cs (2)
9public sealed partial class JsonArray : JsonNode, IList<JsonNode?>
System\Text\Json\Nodes\JsonObject.cs (1)
19public sealed partial class JsonObject : JsonNode
System\Text\Json\Nodes\JsonObject.IDictionary.cs (1)
11public partial class JsonObject : IDictionary<string, JsonNode?>
System\Text\Json\Nodes\JsonObject.IList.cs (1)
9public partial class JsonObject : IList<KeyValuePair<string, JsonNode?>>
System\Text\Json\Nodes\JsonValue.cs (1)
14public abstract partial class JsonValue : JsonNode
2031 references to JsonNode
aspire (117)
Agents\AspireSkills\GitHubArtifactAttestationVerifier.cs (4)
151JsonNode? document; 154document = JsonNode.Parse(attestationJson); 167foreach (var attestation in attestations) 169var bundleNode = attestation?["bundle"];
Agents\ClaudeCode\ClaudeCodeAgentEnvironmentScanner.cs (2)
165var config = JsonNode.Parse(content)?.AsObject(); 172if (config.TryGetPropertyValue("mcpServers", out var serversNode) && serversNode is JsonObject servers)
Agents\DeprecatedMcpCommandScanner.cs (11)
65var config = JsonNode.Parse(content)?.AsObject(); 120if (!config.TryGetPropertyValue(serversKey, out var serversNode) || serversNode is not JsonObject servers) 125if (!servers.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire) 130if (!aspire.TryGetPropertyValue("args", out var argsNode) || argsNode is not JsonArray args) 152if (!config.TryGetPropertyValue(serversKey, out var mcpNode) || mcpNode is not JsonObject mcp) 157if (!mcp.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire) 162if (!aspire.TryGetPropertyValue("command", out var commandNode) || commandNode is not JsonArray command) 222if (config.TryGetPropertyValue(serversKey, out var serversNode) && 224servers.TryGetPropertyValue("aspire", out var aspireNode) && 236if (config.TryGetPropertyValue(serversKey, out var mcpNode) && 238mcp.TryGetPropertyValue("aspire", out var aspireNode) &&
Agents\Hooks\TelemetryHookConfigurator.cs (10)
183JsonNode? parsed; 186parsed = JsonNode.Parse(content); 219if (settings.TryGetPropertyValue("hooks", out var hooksNode)) 235if (hooks.TryGetPropertyValue(ClaudePostToolUseKey, out var postToolUseNode)) 279postToolUse.Add((JsonNode?)new JsonObject 323|| !group.TryGetPropertyValue("hooks", out var innerNode) 344private static bool IsAspireHook(JsonNode? node) 356if (hook.TryGetPropertyValue("command", out var commandNode) 364if (hook.TryGetPropertyValue("args", out var argsNode) && argsNode is JsonArray args) 366foreach (var arg in args)
Agents\McpConfigFileHelper.cs (4)
40if (JsonNode.Parse(content) is not JsonObject config) 45if (config.TryGetPropertyValue(serverContainerKey, out var serversNode) && serversNode is JsonObject servers) 83JsonNode? root; 86root = JsonNode.Parse(content);
Agents\OpenCode\OpenCodeAgentEnvironmentScanner.cs (2)
114var config = JsonNode.Parse(content)?.AsObject(); 121if (config.TryGetPropertyValue("mcp", out var mcpNode) && mcpNode is JsonObject mcp)
Agents\VsCode\VsCodeAgentEnvironmentScanner.cs (2)
204var config = JsonNode.Parse(content)?.AsObject(); 211if (config.TryGetPropertyValue("servers", out var serversNode) && serversNode is JsonObject servers)
Backchannel\BackchannelJsonSerializerContext.cs (2)
63[JsonSerializable(typeof(Dictionary<string, JsonNode?>))] 65[JsonSerializable(typeof(JsonNode))]
Backchannel\ResourceSnapshotMapper.cs (3)
176snapshot.Properties.TryGetValue(KnownProperties.Resource.WaitingFor, out var waitingForProperty) && 209private static string? ConvertJsonNodeToString(JsonNode? node) 214private static bool TryConvertJsonNodeToString(JsonNode? node, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out string? value)
Commands\DescribeCommand.cs (2)
34[JsonSerializable(typeof(JsonNode))] 35[JsonSerializable(typeof(Dictionary<string, JsonNode?>))]
Commands\InitCommand.cs (1)
557settings = JsonNode.Parse(existingContent)?.AsObject() ?? new JsonObject();
Commands\ResourceCommand.cs (3)
151var commandArguments = commandArgumentsResult.Arguments; 189JsonNode? commandArguments, 255private static (JsonNode? Arguments, string? ErrorMessage) CreateCommandArguments(ResourceSnapshotCommand? command, string[] capturedArguments, CommandArgumentParseMode parseMode)
Commands\ResourceCommandHelper.cs (2)
40JsonNode? arguments, 69JsonNode? arguments,
Commands\Sdk\SdkDumpCommand.cs (1)
835public JsonNode? Value { get; set; }
Configuration\ConfigurationService.cs (5)
39: JsonNode.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject() ?? new JsonObject(); 71var settings = JsonNode.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject(); 197var settings = JsonNode.Parse(content, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject(); 471JsonNode? node; 474node = JsonNode.Parse(content, documentOptions: ConfigurationHelper.ParseOptions);
Mcp\Tools\ExecuteResourceCommandTool.cs (1)
75JsonNode? commandArguments = null;
Mcp\Tools\ListResourcesTool.cs (2)
19[JsonSerializable(typeof(JsonNode))] 20[JsonSerializable(typeof(Dictionary<string, JsonNode?>))]
Mcp\Tools\McpToolHelpers.cs (1)
125if (snapshot.Properties.TryGetValue(KnownProperties.Resource.ExcludeFromMcp, out var value) && value is not null)
Migrations\TypeScriptAppHostMigration.cs (6)
200if (JsonNode.Parse(File.ReadAllText(configPath)) is not JsonObject root || 241if (JsonNode.Parse( 254foreach (var entry in include) 260rewritten.Add((JsonNode?)JsonValue.Create(LegacyTypeScriptAppHost.RewriteTsConfigIncludeEntry(value.GetValue<string>()))); 287if (JsonNode.Parse(File.ReadAllText(packageJsonPath)) is not JsonObject root || 303scripts[script.Key] = (JsonNode?)JsonValue.Create(rewritten);
Npm\SigstoreNpmProvenanceChecker.cs (6)
186JsonNode? doc; 189doc = JsonNode.Parse(attestationJson); 197var attestationsNode = doc?["attestations"]; 203foreach (var attestation in attestations) 210var predicateTypeNode = attestationObj["predicateType"]; 231var bundleNode = attestationObj["bundle"];
Projects\FallbackProjectParser.cs (2)
133packageRefArray.Add((JsonNode?)packageObj); 144projectRefArray.Add((JsonNode?)projectObj);
Projects\TypeScriptAppHostToolchainResolver.cs (1)
363var packageJson = JsonNode.Parse(File.ReadAllText(packageJsonPath), documentOptions: ConfigurationHelper.ParseOptions) as JsonObject;
Scaffolding\PackageJsonMerger.cs (6)
62existingJson = JsonNode.Parse(existingContent, documentOptions: s_jsonDocumentOptions) as JsonObject; 63scaffoldJson = JsonNode.Parse(scaffoldContent, documentOptions: s_jsonDocumentOptions) as JsonObject; 123var targetValue = existing[key]; 237var existingVersionNode = existingDeps[packageName]; 269var existingVersionNode = existingDeps[packageName]; 334var targetValue = target[key];
Scaffolding\ScaffoldingService.cs (4)
300packageJson = JsonNode.Parse(existingContent, documentOptions: s_scaffoldJsonDocumentOptions) as JsonObject 677foreach (var entry in scaffoldArray) 679if (!existingArray.Any(present => JsonNode.DeepEquals(present, entry))) 696return JsonNode.Parse(content, documentOptions: s_scaffoldJsonDocumentOptions) as JsonObject;
src\Aspire.Hosting\Backchannel\BackchannelDataTypes.cs (3)
455public JsonNode? Arguments { get; init; } 494public JsonNode? Arguments { get; init; } 1182public Dictionary<string, JsonNode?> Properties { get; init; } = [];
src\Shared\ConsoleLogs\SharedAIHelpers.cs (6)
45public static int EstimateSerializedJsonTokenSize(JsonNode node) 160var jsonArray = new JsonArray(spans.Select(s => GetSpanDto(s, context, getResourceName, dashboardBaseUrl)).ToArray<JsonNode>()); 174var jsonArray = new JsonArray(logRecords.Select(l => GetLogEntryDto(l, context, getResourceName, dashboardBaseUrl)).ToArray<JsonNode>()); 188var jsonArray = new JsonArray(traces.Select(t => GetTraceDto(t, context, getResourceName, dashboardBaseUrl)).ToArray<JsonNode>()); 233var linkObjects = span.Links.Select(link => (JsonNode)new JsonObject 385var spanObjects = new List<JsonNode>();
src\Shared\Json\AtsJsonCodeWriter.cs (1)
23internal static string ToRelaxedJsonString(this JsonNode value)
src\Shared\Json\JsonFlattener.cs (1)
38if (!current.TryGetPropertyValue(key, out var existing) || existing is not JsonObject)
src\Shared\Model\Serialization\ResourceJson.cs (1)
106public Dictionary<string, JsonNode?>? Properties { get; set; }
src\Shared\Otlp\Serialization\OtlpJsonSerializerContext.cs (2)
34[JsonSerializable(typeof(JsonNode))] 35[JsonSerializable(typeof(Dictionary<string, JsonNode?>))]
src\Shared\UserSecrets\SecretsStore.cs (1)
127var parsed = JsonNode.Parse(json)?.AsObject();
Telemetry\InternalMicrosoftDetector.cs (5)
749if (!userConfiguration.TryGetPropertyValue("kerberosStatus", out var kerberosStatusNode) || 765foreach (var kerberosStatusNodeEntry in kerberosStatuses) 1689return JsonNode.Parse( 1860return json.TryGetPropertyValue(propertyName, out var node) && 1886return json.TryGetPropertyValue(propertyName, out var value) &&
Utils\ConfigurationHelper.cs (6)
190var node = JsonNode.Parse(content, documentOptions: ParseOptions); 266var node = JsonNode.Parse(content, documentOptions: ParseOptions); 299var settings = JsonNode.Parse(content, documentOptions: ParseOptions)?.AsObject(); 307var colonKeys = new List<(string key, JsonNode? value)>();
Utils\EnvironmentChecker\DeprecatedAgentConfigCheck.cs (7)
56var config = JsonNode.Parse(content)?.AsObject(); 107if (!config.TryGetPropertyValue(serversKey, out var serversNode) || serversNode is not JsonObject servers) 112if (!servers.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire) 117if (!aspire.TryGetPropertyValue("args", out var argsNode) || argsNode is not JsonArray args) 139if (!config.TryGetPropertyValue(serversKey, out var mcpNode) || mcpNode is not JsonObject mcp) 144if (!mcp.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire) 149if (!aspire.TryGetPropertyValue("command", out var commandNode) || commandNode is not JsonArray command)
Utils\EnvironmentChecker\DevCertsCheck.cs (1)
538certificatesArray.Add((JsonNode)certNode);
Aspire.Cli.EndToEnd.Tests (22)
CSharpInitTests.cs (7)
126var config = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json"))); 141var description = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "resources.json"))); 195var config = JsonNode.Parse(configText); 198var appHostNode = config["appHost"];
Helpers\CliE2ETestHelpers.cs (1)
1115? JsonNode.Parse(File.ReadAllText(configPath))?.AsObject() ?? new JsonObject()
Helpers\TypeScriptAppHostToolchainTestHelpers.cs (1)
37var packageJson = JsonNode.Parse(File.ReadAllText(packageJsonPath))?.AsObject()
ProjectReferenceTests.cs (1)
116var config = JsonNode.Parse(configJson)?.AsObject()
SelfUpdateChannelPersistenceTests.cs (1)
108return JsonNode.Parse(File.ReadAllText(path))?.AsObject()
SingleFileAppHostInitDotnetRunTests.cs (1)
83var runJson = JsonNode.Parse(File.ReadAllText(appHostRunJson))?.AsObject();
TypeScriptEmptyAppHostTemplateTests.cs (1)
178var config = JsonNode.Parse(File.ReadAllText(configPath))?.AsObject()
TypeScriptLegacyAppHostTests.cs (1)
136var configJson = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject();
TypeScriptMigrateAppHostTests.cs (2)
123var configJson = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 215var tsconfig = JsonNode.Parse(File.ReadAllText(Path.Combine(projectRoot, "tsconfig.apphost.json")))!.AsObject();
TypeScriptPolyglotTests.cs (6)
353var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 448var packageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(projectRoot, "package.json")))!.AsObject(); 479packageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(projectRoot, "package.json")))!.AsObject(); 504var appHostPackageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(appHostDirectory, "package.json")))!.AsObject(); 520var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 523var packagesNode = config["packages"];
Aspire.Cli.Tests (98)
Agents\CopilotAgentEnvironmentScannerTests.cs (2)
63var config = JsonNode.Parse(content)?.AsObject(); 143var config = JsonNode.Parse(content)?.AsObject();
Agents\TelemetryHookConfiguratorTests.cs (9)
30var root = JsonNode.Parse(await File.ReadAllTextAsync(hookFile).DefaultTimeout())!.AsObject(); 159var root = JsonNode.Parse(await File.ReadAllTextAsync(settingsPath).DefaultTimeout())!.AsObject(); 245var root = JsonNode.Parse(await File.ReadAllTextAsync(settingsPath))!.AsObject(); 252private static bool GroupContainsAspireHook(JsonNode? group) 259private static bool HookReferencesTelemetryScript(JsonNode? hook) 264private static bool JsonValueHasTelemetryScript(JsonNode? node) 267private static bool GroupContainsCommand(JsonNode? group, string command) 276foreach (var group in postToolUse) 280foreach (var hook in hooks)
Agents\VsCodeAgentEnvironmentScannerTests.cs (3)
147var config = JsonNode.Parse(content)?.AsObject(); 200var config = JsonNode.Parse(content)?.AsObject(); 246var config = JsonNode.Parse(content)?.AsObject();
Backchannel\ResourceSnapshotMapperTests.cs (3)
342Properties = new Dictionary<string, JsonNode?> 344["custom.list"] = new JsonArray((JsonNode?)JsonValue.Create("one"), (JsonNode?)JsonValue.Create("two"))
Commands\ConfigCommandTests.cs (14)
126var settings = JsonNode.Parse(json)?.AsObject(); 151var settings = JsonNode.Parse(settingsJson)?.AsObject(); 186var settings = JsonNode.Parse(json)?.AsObject(); 211var settings = JsonNode.Parse(json)?.AsObject(); 243var settings = JsonNode.Parse(json)?.AsObject(); 363var settings = JsonNode.Parse(json)?.AsObject(); 692var settings = JsonNode.Parse(json)?.AsObject(); 724var settings = JsonNode.Parse(json)?.AsObject(); 755var settings = JsonNode.Parse(json)?.AsObject(); 786var settings = JsonNode.Parse(json)?.AsObject(); 816var settings = JsonNode.Parse(json)?.AsObject(); 849var settings = JsonNode.Parse(json)?.AsObject(); 875var settings = JsonNode.Parse(json)?.AsObject(); 905var settings = JsonNode.Parse(json)?.AsObject();
Commands\DescribeCommandTests.cs (1)
736Properties = new Dictionary<string, JsonNode?>
Commands\InitCommandTests.cs (12)
225var config = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)))!.AsObject(); 267var config = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject(); 295var runJson = JsonNode.Parse(File.ReadAllText(runJsonPath))!.AsObject(); 319var aspireConfig = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject(); 373var runJson = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.run.json")))!.AsObject(); 426var aspireConfig = JsonNode.Parse(File.ReadAllText(aspireConfigPath))!.AsObject(); 565var config = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject(); 869var merged = JsonNode.Parse(await File.ReadAllTextAsync(configPath))!.AsObject(); 1316var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 1355var config = JsonNode.Parse(await File.ReadAllTextAsync(configPath))!.AsObject(); 1387var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 1431var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject();
Commands\ResourceCommandTests.cs (4)
1763var json = JsonNode.Parse(output.ToString()); 2278private static void AssertJsonObject(JsonNode? actual, params (string Name, string? Value)[] expected) 2286Assert.True(actualObject.TryGetPropertyValue(name, out var actualValue), $"Expected argument '{name}' to exist.");
Commands\TelemetryTestHelper.cs (2)
133var node = JsonNode.Parse(compactJson);
Commands\TelemetryTracesCommandTests.cs (3)
137var items = JsonNode.Parse(jsonLine)!.AsArray(); 140var item = items[0]!; 225var items = JsonNode.Parse(jsonLine)!.AsArray();
Configuration\ConfigurationHelperTests.cs (4)
131var json = JsonNode.Parse(File.ReadAllText(settingsPath)); 132var polyglotNode = json!["features"]!["polyglotSupportEnabled"]; 133var templatesNode = json!["features"]!["showAllTemplates"];
Configuration\ConfigurationServiceTests.cs (9)
310var json = JsonNode.Parse(File.ReadAllText(settingsFilePath)); 311var node = json!["features"]!["polyglotSupportEnabled"]; 333var json = JsonNode.Parse(File.ReadAllText(settingsFilePath)); 334var node = json!["channel"]; 353var json = JsonNode.Parse(File.ReadAllText(settingsFilePath)); 354var node = json!["channel"];
Mcp\ExcludeFromMcpTests.cs (9)
43Properties = new Dictionary<string, JsonNode?> 58Properties = new Dictionary<string, JsonNode?> 73Properties = new Dictionary<string, JsonNode?> 88Properties = new Dictionary<string, JsonNode?> 118Properties = new Dictionary<string, JsonNode?> 151Properties = new Dictionary<string, JsonNode?> 183Properties = new Dictionary<string, JsonNode?> 255Properties = new Dictionary<string, JsonNode?> 449Properties = new Dictionary<string, JsonNode?>
Mcp\ListStructuredLogsToolTests.cs (1)
191var logsArray = JsonNode.Parse(jsonText)?.AsArray();
Mcp\ListTracesToolTests.cs (1)
163var tracesArray = JsonNode.Parse(jsonText)?.AsArray();
Migrations\TypeScriptAppHostMigrationTests.cs (7)
189var config = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(root.FullName, "aspire.config.json")))!; 192var tsconfig = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(root.FullName, "tsconfig.apphost.json")))!; 196var packageJson = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(root.FullName, "package.json")))!; 197var scripts = packageJson["scripts"]!;
Scaffolding\PackageJsonMergerTests.cs (5)
19JsonNode.Parse(json)!.AsObject(); 997var weirdPkg = ParseJson(result)["dependencies"]!["weird-pkg"]; 1248var doc = JsonNode.Parse(result)!.AsObject(); 1301var doc = JsonNode.Parse(result)!.AsObject(); 1486var doc = JsonNode.Parse(result)!.AsObject();
Scaffolding\ScaffoldingServiceTests.cs (8)
89var packageJson = JsonNode.Parse("""{ "scripts": { "aspire:start": "npm --prefix aspire-apphost run aspire:start" } }""")!.AsObject(); 99var packageJson = JsonNode.Parse("""{ "scripts": { "aspire:start": "npm --prefix aspire-apphost run aspire:start" } }""")!.AsObject(); 109var packageJson = JsonNode.Parse("""{ "scripts": { "aspire:start": "npm --prefix aspire-apphost run aspire:start" } }""")!.AsObject(); 119var scripts = JsonNode.Parse("""{ "test": "vitest" }""")!.AsObject(); 182var scripts = JsonNode.Parse(""" 321var merged = JsonNode.Parse( 344var merged = JsonNode.Parse( 368var merged = JsonNode.Parse(
TestServices\TestAppHostAuxiliaryBackchannel.cs (1)
293public JsonNode? ExecuteResourceCommandArguments { get; private set; }
Aspire.Dashboard (29)
Model\GenAI\GenAIEvents.cs (2)
25public JsonNode? Content { get; set; } 45public JsonNode? Arguments { get; set; }
Model\GenAI\GenAIItemPartViewModel.cs (1)
144jsonObject[kvp.Key] = JsonNode.Parse(kvp.Value.GetRawText());
Model\GenAI\GenAIMessageParsingHelper.cs (4)
145internal static JsonNode? TryParseStringJsonNode(JsonNode? node) 151var parsed = JsonNode.Parse(json);
Model\GenAI\GenAIMessages.cs (4)
55public JsonNode? Arguments { get; set; } 69public JsonNode? Response { get; set; } = default!; 142public JsonNode? ServerToolCall { get; set; } 156public JsonNode? ServerToolCallResponse { get; set; }
Model\GenAI\GenAISchemaHelpers.cs (5)
49foreach (var item in requiredArray) 61schema.Enum = new List<JsonNode>(); 62foreach (var item in enumArray) 74internal static JsonSchemaType? ParseTypeValue(JsonNode? typeNode) 89foreach (var item in typeArray)
Model\GenAI\GenAIVisualizerDialogViewModel.cs (5)
91var jsonNode = JsonNode.Parse(toolDefinitionsJson, documentOptions: documentOptions); 95foreach (var item in array) 520var toolResponse = GenAIMessageParsingHelper.TryParseStringJsonNode(toolEvent.Content); 557var args = GenAIMessageParsingHelper.TryParseStringJsonNode(function.Arguments);
Model\GenAI\ToolDefinitionSchema.cs (1)
15public List<JsonNode>? Enum { get; set; }
Model\Serialization\ResourceJsonSerializerContext.cs (2)
23[JsonSerializable(typeof(JsonNode))] 24[JsonSerializable(typeof(Dictionary<string, JsonNode?>))]
Model\TelemetryExportService.cs (1)
786private static JsonNode? ConvertPropertyValueToJsonNode(Google.Protobuf.WellKnownTypes.Value value)
Otlp\Model\OtlpHelpers.cs (1)
168private static JsonNode? ConvertAnyValue(AnyValue value)
src\Shared\Model\Serialization\ResourceJson.cs (1)
106public Dictionary<string, JsonNode?>? Properties { get; set; }
src\Shared\Otlp\Serialization\OtlpJsonSerializerContext.cs (2)
34[JsonSerializable(typeof(JsonNode))] 35[JsonSerializable(typeof(Dictionary<string, JsonNode?>))]
Aspire.Dashboard.Components.Tests (2)
Controls\GenAIVisualizerDialogTests.cs (2)
98Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments = JsonNode.Parse(@"{""count"":2}") }] 103Parts = [new ToolCallResponsePart { Response = JsonNode.Parse(@"[""Jack"",""Jane""]") }]
Aspire.Dashboard.Tests (17)
Model\GenAIItemPartViewModelTests.cs (4)
64Response = JsonNode.Parse("""["Jack","Jane"]""") 96Response = JsonNode.Parse("""{"name":"Jack","age":30}""") 121Arguments = JsonNode.Parse("""{"location":"東京","unit":"celsius"}""") 138Response = JsonNode.Parse("""{"weather":"晴れ","city":"東京"}""")
Model\GenAISchemaHelpersTests.cs (8)
113var typeAsObject = JsonNode.Parse("""{"description": "This is an object instead of a string"}"""); 122var typeArrayWithObjects = JsonNode.Parse("""["string", {"invalid": "object"}, "number"]""") as JsonArray; 136var typeArrayWithOnlyObjects = JsonNode.Parse("""[{"invalid": "object"}, {"another": "object"}]""") as JsonArray; 151var typeString = JsonNode.Parse("\"string\""); 159var typeArray = JsonNode.Parse("""["string", "null"]""") as JsonArray; 185var schemaObj = JsonNode.Parse(schemaJson) as JsonObject;
Model\GenAIVisualizerDialogViewModelTests.cs (4)
511Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments = JsonNode.Parse(@"{""count"":2}") }] 516Parts = [new ToolCallResponsePart { Response = JsonNode.Parse(@"[""Jack"",""Jane""]") }] 635Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments = JsonNode.Parse(@"{""count"":2}") }] 640Parts = [new ToolCallResponsePart { Response = JsonNode.Parse(@"[""Jack"",""Jane""]") }]
Model\TelemetryExportServiceTests.cs (1)
1433var waitingForPropertyValue = Assert.Single(waitingForProperty);
Aspire.Hosting (82)
Ats\UserSecretsExports.cs (1)
43var state = JsonNode.Parse(json) as JsonObject
Backchannel\AuxiliaryBackchannelRpcTarget.cs (7)
345var arguments = request.Arguments; 407private static string? ConvertArgumentValue(string name, JsonNode? value) 1150var properties = new Dictionary<string, JsonNode?>(); 1386private static JsonNode? ConvertPropertyValueToJsonNode(object? value) 1391JsonNode jsonNode => jsonNode.DeepClone(), 1422private static JsonNode? ConvertPropertyValueToLegacyJsonNode(object? value) 1437JsonNode jsonNode => jsonNode.ToJsonString(),
Backchannel\BackchannelDataTypes.cs (3)
455public JsonNode? Arguments { get; init; } 494public JsonNode? Arguments { get; init; } 1182public Dictionary<string, JsonNode?> Properties { get; init; } = [];
Dashboard\DashboardEventHandlers.cs (4)
145var configJson = JsonNode.Parse(configText)?.AsObject(); 158foreach (var framework in frameworks) 237var configJson = JsonNode.Parse(originalConfigText)?.AsObject(); 251foreach (var framework in frameworks)
Dcp\DcpExecutor.cs (2)
1156var current = JsonSerializer.SerializeToNode(obj); 1161var changed = JsonSerializer.SerializeToNode(copy);
Dcp\JsonPatch.cs (22)
17internal static JsonArray Create(JsonNode? current, JsonNode? changed) 25internal static JsonNode? Apply(JsonNode? current, JsonArray patch) 27var result = current?.DeepClone(); 29foreach (var operationNode in patch) 41var hasValue = operation.TryGetPropertyValue("value", out var value); 48private static void AddOperations(JsonNode? current, JsonNode? changed, string path, JsonArray operations) 50if (JsonNode.DeepEquals(current, changed)) 68if (currentObject.TryGetPropertyValue(property.Key, out var currentValue)) 105private static JsonObject CreateOperation(string operation, string path, JsonNode? value = null) 179private static JsonNode? ApplyOperation(JsonNode? current, string operation, string[] segments, bool hasValue, JsonNode? value) 200var parent = GetParent(current, segments); 218private static JsonNode GetParent(JsonNode? current, string[] segments) 220var parent = current ?? throw new JsonException("A JSON Patch path cannot traverse a null value."); 227JsonObject jsonObject when jsonObject.TryGetPropertyValue(segment, out var child) && child is not null => child, 237private static void ApplyToObject(JsonObject target, string operation, string propertyName, JsonNode? value) 260private static void ApplyToArray(JsonArray target, string operation, string indexText, JsonNode? value)
Devcontainers\DevcontainerSettingsWriter.cs (2)
123if (!settings.TryGetPropertyValue(PortAttributesFieldName, out var portsAttributesNode)) 167if (!portsAttributes.TryGetPropertyValue(port, out var portAttributeNode))
Pipelines\Internal\DeploymentStateManagerBase.cs (7)
66protected virtual JsonNode? GetSectionState(JsonObject? state, string sectionName, bool includeLegacyState) => 136if (JsonNode.Parse(fileContent, documentOptions: jsonDocumentOptions) is not JsonObject flattenedState) 192var sectionData = GetSectionState(_state, sectionName, includeLegacyState); 224protected static JsonNode? TryGetNestedPropertyValue(JsonObject? node, string path) 232JsonNode? current = node; 236if (current is not JsonObject currentObj || !currentObj.TryGetPropertyValue(segment, out var nextNode)) 334if (!current.TryGetPropertyValue(segment, out var nextNode) || nextNode is not JsonObject nextObj)
Pipelines\Internal\FileDeploymentStateManager.cs (28)
271protected override JsonNode? GetSectionState(JsonObject? state, string sectionName, bool includeLegacyState) 286var mergedSection = base.GetSectionState(state, sectionName, includeLegacyState)?.DeepClone(); 350var legacySectionData = TryGetNestedPropertyValue(GetLegacyFallbackState(), sectionName); 381private static JsonObject? NormalizeSectionData(JsonNode? sectionData) => 502JsonNode? legacyValue, 503JsonNode? savedValue, 515JsonNode? baseline, 517JsonNode? value, 525var baselinePropertyExists = baselineObject.TryGetPropertyValue(propertyName, out var baselineProperty); 526var savedPropertyExists = valueObject.TryGetPropertyValue(propertyName, out var valueProperty); 538if (baselineExists == savedExists && JsonNode.DeepEquals(baseline, value)) 548private static JsonNode? ApplyChanges(JsonNode? latestValue, JsonNode? originalValue, JsonNode? savedValue) 560var originalPropertyExists = originalObject.TryGetPropertyValue(propertyName, out var originalProperty); 561var savedPropertyExists = savedObject.TryGetPropertyValue(propertyName, out var savedProperty); 562var latestPropertyExists = result.TryGetPropertyValue(propertyName, out var latestProperty); 583return JsonNode.DeepEquals(originalValue, savedValue) 587static (bool Exists, JsonNode? Value) ApplyPropertyChanges( 588JsonNode? latestValue, 590JsonNode? originalValue, 592JsonNode? savedValue, 595if (originalExists == savedExists && JsonNode.DeepEquals(originalValue, savedValue)) 648if (!current.TryGetPropertyValue(segments[i], out var nextNode) || 660private static void SetNestedNodeValue(JsonObject root, string path, JsonNode? value, bool valueExists) 667if (!current.TryGetPropertyValue(segment, out var nextNode) || nextNode is not JsonObject nextObject) 764JsonValue stateValue => JsonNode.Parse(stateValue.GetValue<string>())?.AsObject()
Pipelines\Internal\JsonFlattener.cs (1)
44if (!current.TryGetPropertyValue(key, out var existing) || existing is not JsonObject)
Publishing\ContainerRuntimeBase.cs (5)
188var root = JsonNode.Parse(output) as JsonObject; 210private static IReadOnlyList<string> ReadStringArray(JsonNode? node) 218foreach (var item in array) 246var root = JsonNode.Parse(output);
Aspire.Hosting.Azure (24)
AzureBicepResource.cs (1)
259if (inputValue is JsonNode || inputValue is IEnumerable<string>)
AzureBicepResourceExtensions.cs (1)
217public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, JsonNode value)
AzureProvisioningController.cs (6)
2499deployment.TryGetPropertyValue("resourceId", out var resourceIdNode) ? resourceIdNode?.GetValue<string>() : null, 2514var outputs = ParseDeploymentStateJson(resource.Name, "Outputs", section.Data["Outputs"]?.GetValue<string>()); 2629private JsonNode? ParseDeploymentStateJson(string resourceName, string propertyName, string? json) 2653private static string? TryGetOutputValue(JsonNode? outputs, string outputName) 2659!outputsObject.TryGetPropertyValue(outputName, out var outputNode) || 2661!outputObject.TryGetPropertyValue("value", out var valueNode))
AzureProvisioningFailureDetails.cs (2)
566if (JsonNode.Parse(content) is not JsonObject responseObj) 624foreach (var detail in detailsArray)
AzureProvisioningJsonHelpers.cs (2)
26internal static JsonNode? ParseDeploymentStateJson(string json) 32return JsonNode.Parse(json, documentOptions: s_deploymentStateJsonDocumentOptions);
Provisioning\BicepUtilities.cs (5)
64JsonNode node => node, 134var parameters = JsonNode.Parse(jsonString)?.AsObject(); 136? JsonNode.Parse(scopeString)?.AsObject() 178var parameters = JsonNode.Parse(jsonString)?.AsObject(); 180? JsonNode.Parse(scopeString)?.AsObject()
Provisioning\Internal\RunModeProvisioningContextProvider.cs (1)
263private static bool? TryGetBoolean(JsonNode? value)
Provisioning\JsonExtensions.cs (3)
10internal static JsonNode Prop(this JsonNode obj, string key) 15var node = jsonObj[key];
Provisioning\Provisioners\BicepProvisioner.cs (3)
86JsonNode? outputObj = null; 89outputObj = JsonNode.Parse(outputJson); 1500if (JsonNode.Parse(parametersJson)?[AzureBicepResource.KnownParameters.Location]?["value"]?.GetValue<string>() is { Length: > 0 } configuredLocation)
Aspire.Hosting.Azure.EventHubs (5)
AzureEventHubsExtensions.cs (3)
330var tempConfig = JsonNode.Parse(CreateEmulatorConfigJson(builder.Resource)); 449public static IResourceBuilder<AzureEventHubsEmulatorResource> WithConfiguration(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, Action<JsonNode> configJson)
ConfigJsonAnnotation.cs (2)
14public ConfigJsonAnnotation(Action<JsonNode> configure) 19public Action<JsonNode> Configure { get; }
Aspire.Hosting.Azure.Kubernetes (2)
AzureKubernetesEnvironmentResource.AksPipeline.cs (2)
419var scope = JsonNode.Parse(scopeJson)?.AsObject() 475var resourceId = JsonNode.Parse(outputsJson)?["id"]?["value"]?.GetValue<string>();
Aspire.Hosting.Azure.Sandboxes (3)
AzureSandboxContainerDeployment.cs (3)
2020.Select(static endpoint => (JsonNode)new JsonObject 2033.Select(static identity => (JsonNode)new JsonObject 2047.Select(static rule => (JsonNode)new JsonObject
Aspire.Hosting.Azure.ServiceBus (5)
AzureServiceBusExtensions.cs (3)
480var tempConfig = JsonNode.Parse(CreateEmulatorConfigJson(builder.Resource)); 559public static IResourceBuilder<AzureServiceBusEmulatorResource> WithConfiguration(this IResourceBuilder<AzureServiceBusEmulatorResource> builder, Action<JsonNode> configJson)
ConfigJsonAnnotation.cs (2)
14public ConfigJsonAnnotation(Action<JsonNode> configure) 19public Action<JsonNode> Configure { get; }
Aspire.Hosting.Azure.Tests (43)
AzureAppServiceTests.cs (1)
1398private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureBicepProvisionerTests.cs (1)
1599var outputs = JsonNode.Parse(section.Data[BicepUtilities.DeploymentStateOutputsKey]!.GetValue<string>())!.AsObject();
AzureBicepResourceTests.cs (1)
191var manifest = await ManifestUtils.GetManifest(bicepResource.Resource);
AzureContainerAppsTests.cs (1)
1781private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureDeployerTests.cs (4)
1670var stateJson = JsonNode.Parse(stateContent); 1792var stateJson = JsonNode.Parse(stateContent);
AzureEnvironmentResourceExtensionsTests.cs (1)
5029return Assert.IsType<JsonObject>(JsonNode.Parse(data.Value));
AzureFunctionsTests.cs (1)
457private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureInfrastructureExtensionsTests.cs (3)
27var manifest = await ManifestUtils.GetManifest(infrastructure1.Resource); 52var manifest = await ManifestUtils.GetManifest(infrastructure1.Resource); 91var manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
AzureManifestUtils.cs (5)
16public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource, bool skipPreparer = false) => 19public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource) => 22private static async Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource, bool skipPreparer) 32var manifestNode = await ManifestUtils.GetManifest(resource, manifestDir); 34if (!manifestNode.AsObject().TryGetPropertyValue("path", out var pathNode))
AzurePostgresExtensionsTests.cs (1)
561var manifest = await ManifestUtils.GetManifest(postgres.Resource);
AzureStorageExtensionsTests.cs (12)
490var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 505var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 520var tableManifest = await ManifestUtils.GetManifest(table.Resource); 575var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 590var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 605var tableManifest = await ManifestUtils.GetManifest(table.Resource); 713var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 726var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 739var tableManifest = await ManifestUtils.GetManifest(table.Resource); 795var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 810var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 825var tableManifest = await ManifestUtils.GetManifest(table.Resource);
JsonExtensionsTests.cs (4)
15var azureNode = rootJson.Prop("Azure"); 19var retrievedNode = rootJson.Prop("Azure"); 33var newNode = rootJson.Prop("NewProperty"); 47var deeply = rootJson.Prop("Level1")
ProvisioningContextTests.cs (2)
191var parsed = JsonNode.Parse(result);
ProvisioningTestHelpers.cs (1)
1040var sectionData = _state.TryGetPropertyValue(sectionName, out var node) && node is JsonObject obj
PublicApiTests\EventHubsPublicApiTests.cs (2)
359Action<JsonNode> configJson = (_) => { }; 372Action<JsonNode> configJson = null!;
PublicApiTests\ServiceBusPublicApiTests.cs (2)
291Action<JsonNode> configJson = (_) => { }; 304Action<JsonNode> configJson = null!;
RoleAssignmentTests.cs (1)
373private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
Aspire.Hosting.CodeGeneration.Go (3)
AtsGoCodeGenerator.cs (2)
682JsonNode? value, 728if (!value.TryGetPropertyValue(property.Name, out var propertyValue))
src\Shared\Json\AtsJsonCodeWriter.cs (1)
23internal static string ToRelaxedJsonString(this JsonNode value)
Aspire.Hosting.CodeGeneration.Go.Tests (1)
AtsGoCodeGeneratorTests.cs (1)
93Value = JsonNode.Parse("[1,null,2.5]"),
Aspire.Hosting.CodeGeneration.Java (3)
AtsJavaCodeGenerator.cs (2)
852JsonNode? value, 889if (!value.TryGetPropertyValue(property.Name, out var propertyValue))
src\Shared\Json\AtsJsonCodeWriter.cs (1)
23internal static string ToRelaxedJsonString(this JsonNode value)
Aspire.Hosting.CodeGeneration.Java.Tests (2)
AtsJavaCodeGeneratorTests.cs (2)
3570Value = JsonNode.Parse("[1,null,2.5]"), 3577Value = JsonNode.Parse("[true,null,false]"),
Aspire.Hosting.CodeGeneration.Python (4)
AtsPythonCodeGenerator.cs (3)
986JsonNode? value, 1027if (!value.TryGetPropertyValue(property.Name, out var propertyValue)) 1038private static string RenderPythonPrimitiveValue(JsonNode value)
src\Shared\Json\AtsJsonCodeWriter.cs (1)
23internal static string ToRelaxedJsonString(this JsonNode value)
Aspire.Hosting.CodeGeneration.Rust (1)
src\Shared\Json\AtsJsonCodeWriter.cs (1)
23internal static string ToRelaxedJsonString(this JsonNode value)
Aspire.Hosting.CodeGeneration.Rust.Tests (1)
AtsRustCodeGeneratorTests.cs (1)
93Value = JsonNode.Parse("[1,null,2.5]"),
Aspire.Hosting.CodeGeneration.TypeScript (10)
src\Shared\Json\AtsJsonCodeWriter.cs (1)
23internal static string ToRelaxedJsonString(this JsonNode value)
TypeScriptApiExportWriter.cs (6)
28modules.Add((JsonNode)WriteModule(module)); 34declarations.Add((JsonNode)new JsonObject 77items.Add((JsonNode)WriteItem(item)); 108members.Add((JsonNode)WriteMember(member)); 150parameters.Add((JsonNode)parameterJson); 191array.Add((JsonNode)JsonValue.Create(value));
TypeScriptApiProjector.cs (2)
764private string RenderTypeScriptExportedValue(JsonNode? value, AtsTypeRef typeRef) 789if (value.TryGetPropertyValue(property.Name, out var propertyValue))
TypeScriptLanguageSupport.cs (1)
218private static string? GetStringValue(JsonNode? node)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (2)
AtsTypeScriptCodeGeneratorTests.cs (1)
43var packageJson = System.Text.Json.Nodes.JsonNode.Parse(content)!.AsObject();
TypeScriptLanguageSupportTests.cs (1)
315private static JsonObject ParseJson(string content) => JsonNode.Parse(content)!.AsObject();
Aspire.Hosting.Containers.Tests (10)
ContainerResourceTests.cs (5)
137var manifest = await ManifestUtils.GetManifest(c2.Resource); 176var manifest = await ManifestUtils.GetManifest(containerResource); 210var manifest = await ManifestUtils.GetManifest(containerResource); 257var manifest = await ManifestUtils.GetManifest(containerResource); 306var manifest = await ManifestUtils.GetManifest(containerResource, manifestDirectory: appHostPath);
WithDockerfileTests.cs (5)
282var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 331var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 379var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 426var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 882var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath);
Aspire.Hosting.Dotnet.Tests (3)
DotnetProjectResourceTests.cs (3)
371var manifest = await ManifestUtils.GetManifestOrNull(resource.Resource, workspace.Path); 387var manifest = await ManifestUtils.GetManifest(resource.Resource, workspace.Path); 405var manifest = await ManifestUtils.GetManifest(resource.Resource, workspace.Path);
Aspire.Hosting.DotnetTool.Tests (2)
AddDotnetToolTests.cs (2)
357var manifest = await ManifestUtils.GetManifest(tool.Resource).DefaultTimeout(); 401var manifest = await ManifestUtils.GetManifest(tool.Resource).DefaultTimeout();
Aspire.Hosting.Foundry.Tests (5)
HostedAgentConfigurationTests.cs (4)
88var payload = JsonNode.Parse(ModelReaderWriter.Write(options, ModelReaderWriterOptions.Json).ToString())!; 89var definition = payload["definition"]!; 91var protocolVersion = Assert.Single(definition["protocol_versions"]!.AsArray());
HostedAgentExtensionTests.cs (1)
187Assert.Equal("hello from dashboard", JsonNode.Parse(fakeHandler.RequestContent!)?["message"]?.GetValue<string>());
Aspire.Hosting.Garnet.Tests (3)
AddGarnetTests.cs (3)
93var manifest = await ManifestUtils.GetManifest(garnet.Resource); 133var manifest = await ManifestUtils.GetManifest(garnet.Resource); 169var manifest = await ManifestUtils.GetManifest(garnet.Resource);
Aspire.Hosting.Go.Tests (20)
AddGoAppTests.cs (20)
28var manifest = await ManifestUtils.GetManifest(app.Resource); 65var manifest = await ManifestUtils.GetManifest(app.Resource); 109var manifest = await ManifestUtils.GetManifest(app.Resource); 133var manifest = await ManifestUtils.GetManifest(app.Resource); 157var manifest = await ManifestUtils.GetManifest(app.Resource); 181var manifest = await ManifestUtils.GetManifest(app.Resource); 209var manifest = await ManifestUtils.GetManifest(app.Resource); 239var manifest = await ManifestUtils.GetManifest(app.Resource); 267var manifest = await ManifestUtils.GetManifest(app.Resource); 292var manifest = await ManifestUtils.GetManifest(app.Resource); 317var manifest = await ManifestUtils.GetManifest(app.Resource); 343var manifest = await ManifestUtils.GetManifest(app.Resource); 370var manifest = await ManifestUtils.GetManifest(app.Resource); 398var manifest = await ManifestUtils.GetManifest(app.Resource); 426var manifest = await ManifestUtils.GetManifest(app.Resource); 458var manifest = await ManifestUtils.GetManifest(app.Resource); 657var manifest = await ManifestUtils.GetManifest(app.Resource); 687var manifest = await ManifestUtils.GetManifest(app.Resource); 717var manifest = await ManifestUtils.GetManifest(app.Resource); 748var manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.Java.Tests (4)
AddJavaAppTests.cs (4)
69var manifest = await ManifestUtils.GetManifest(app.Resource); 92var manifest = await ManifestUtils.GetManifest(app.Resource); 1330var manifest = await ManifestUtils.GetManifest(app.Resource); 1347var manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.JavaScript.Tests (17)
AddBunAppTests.cs (1)
23var manifest = await ManifestUtils.GetManifest(bunApp.Resource);
AddDenoAppTests.cs (3)
27var manifest = await ManifestUtils.GetManifest(denoApp.Resource); 50var manifest = await ManifestUtils.GetManifest(denoApp.Resource); 1092var manifest = await ManifestUtils.GetManifest(denoApp.Resource, workspace.Path);
AddJavaScriptAppTests.cs (3)
284var manifest = await ManifestUtils.GetManifest(app.Resource, workspace.Path); 302var manifest = await ManifestUtils.GetManifest(app.Resource, workspace.Path); 321var manifest = await ManifestUtils.GetManifest(app.Resource, workspace.Path);
AddNodeAppTests.cs (1)
32var manifest = await ManifestUtils.GetManifest(nodeApp.Resource);
AddViteAppTests.cs (9)
37var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 328var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 348var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 373var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 399var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 425var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 442var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 466var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path); 484var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, workspace.Path);
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
82var manifest = await ManifestUtils.GetManifest(kafka.Resource);
Aspire.Hosting.Keycloak.Tests (1)
KeycloakResourceBuilderTests.cs (1)
154var manifest = await ManifestUtils.GetManifest(keycloak.Resource);
Aspire.Hosting.Kubernetes (5)
KubernetesEnvironmentResource.cs (3)
2085metadataNode["annotations"] = System.Text.Json.Nodes.JsonNode.Parse(annotations.GetRawText()); 2090metadataNode["labels"] = System.Text.Json.Nodes.JsonNode.Parse(labels.GetRawText()); 2104minimal["spec"] = System.Text.Json.Nodes.JsonNode.Parse(spec.GetRawText());
KubernetesManifestResource.cs (2)
153JsonNode node => NormalizeJsonNode(node), 212private static object? NormalizeJsonNode(JsonNode node)
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
136var serverManifest = await ManifestUtils.GetManifest(milvus.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes 137var dbManifest = await ManifestUtils.GetManifest(db1.Resource);
Aspire.Hosting.MongoDB.Tests (3)
AddMongoDBTests.cs (2)
226var mongoManifest = await ManifestUtils.GetManifest(mongo.Resource); 227var dbManifest = await ManifestUtils.GetManifest(db.Resource);
ConnectionPropertiesTests.cs (1)
105var manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.MySql.Tests (4)
AddMySqlTests.cs (3)
160var mySqlManifest = await ManifestUtils.GetManifest(mysql.Resource); 161var dbManifest = await ManifestUtils.GetManifest(db.Resource); 199var serverManifest = await ManifestUtils.GetManifest(mysql.Resource);
ConnectionPropertiesTests.cs (1)
92var manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.Nats.Tests (3)
AddNatsTests.cs (2)
193var manifest = await ManifestUtils.GetManifest(nats.Resource); 230var manifest = await ManifestUtils.GetManifest(nats.Resource);
ConnectionPropertiesTests.cs (1)
66var manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.Oracle.Tests (4)
AddOracleTests.cs (3)
199var serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource); 200var dbManifest = await ManifestUtils.GetManifest(db.Resource); 238var serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
ConnectionPropertiesTests.cs (1)
88var oracleManifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.PostgreSQL.Tests (3)
AddPostgresTests.cs (3)
274var serverManifest = await ManifestUtils.GetManifest(pgServer.Resource); 275var dbManifest = await ManifestUtils.GetManifest(db.Resource); 318var serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
Aspire.Hosting.Python.Tests (2)
AddPythonAppTests.cs (2)
39var manifest = await ManifestUtils.GetManifest(pyproj.Resource, manifestDirectory: projectDirectory); 77var manifest = await ManifestUtils.GetManifest(pyproj.Resource, manifestDirectory: projectDirectory);
Aspire.Hosting.Qdrant.Tests (2)
AddQdrantTests.cs (2)
249var serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes 287var serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
Aspire.Hosting.RabbitMQ.Tests (3)
AddRabbitMQTests.cs (2)
207var manifest = await ManifestUtils.GetManifest(rabbit.Resource); 252var manifest = await ManifestUtils.GetManifest(rabbit.Resource);
ConnectionPropertiesTests.cs (1)
66var manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.Redis.Tests (17)
AddRedisTests.cs (14)
152var fullManifest = await ManifestUtils.GetManifestForModel(model); 153var resources = fullManifest["resources"]!; 154var manifest = resources["redis"]!; 177var fullManifest = await ManifestUtils.GetManifestForModel(model); 178var resources = fullManifest["resources"]!; 179var manifest = resources["redis"]!; 206var fullManifest = await ManifestUtils.GetManifestForModel(model); 207var resources = fullManifest["resources"]!; 208var manifest = resources["redis"]!; 232var fullManifest = await ManifestUtils.GetManifestForModel(model); 233var resources = fullManifest["resources"]!; 234var manifest = resources["redis"]!; 1070private static void AssertConditionalExpressionInManifest(JsonNode resources, string creName) 1072var creEntry = resources[creName];
RedisFunctionalTests.cs (3)
714var jo = JsonNode.Parse(content); 716var agreements = jo["agreements"];
Aspire.Hosting.RemoteHost (78)
Ats\AtsCallbackProxyFactory.cs (14)
134var addMethod = jsonObjectType.GetMethod("Add", [typeof(string), typeof(JsonNode)]); 173private JsonNode? MarshalArg(object? value, Type declaredType) 241_invoker.InvokeAsync<JsonNode?>(callbackId, args, cancellationToken).GetAwaiter().GetResult(); 247var result = _invoker.InvokeAsync<JsonNode?>(callbackId, args, cancellationToken).GetAwaiter().GetResult(); 254var result = _invoker.InvokeAsync<JsonNode?>(callbackId, args, cancellationToken).GetAwaiter().GetResult(); 261await _invoker.InvokeAsync<JsonNode?>(callbackId, args, cancellationToken).ConfigureAwait(false); 267var result = await _invoker.InvokeAsync<JsonNode?>(callbackId, args, cancellationToken).ConfigureAwait(false); 274var result = await _invoker.InvokeAsync<JsonNode?>(callbackId, args, cancellationToken).ConfigureAwait(false); 278private T? UnmarshalResult<T>(JsonNode? result, string callbackId) 373private void ApplyDtoWriteback(JsonNode? result, object?[] originalArgs, Type[] argTypes)
Ats\AtsMarshaller.cs (16)
137public JsonNode? MarshalToJson(object? value, AtsTypeRef typeRef) 174public JsonNode? MarshalToJson(object? value, Type declaredType) 207private static JsonNode? SerializePrimitive(object value) 232private static JsonNode? SerializeDto(object value) 235return JsonNode.Parse(json); 391var node = JsonNode.Parse(ref reader); 401private JsonNode? SerializeArray(object value, AtsTypeRef? elementType) 455public JsonNode? MarshalToJson(object? value) 483private JsonNode? SerializeArrayRuntime(object value) 493private JsonNode? SerializeCancellationToken(CancellationToken cancellationToken) 504private JsonNode? MarshalListHandle(object value, Type type) 519private JsonNode? MarshalDictHandle(object value, Type type) 542public object? UnmarshalFromJson(JsonNode? node, Type targetType, UnmarshalContext context) 736private static string DescribeJsonNode(JsonNode? node) 1043if (!source.TryGetPropertyValue(prop.Name, out var jsonValue))
Ats\CapabilityDispatcher.cs (19)
21internal delegate Task<JsonNode?> CapabilityHandler( 183if (args == null || !args.TryGetPropertyValue("context", out var contextNode)) 230if (args == null || !args.TryGetPropertyValue("context", out var contextNode)) 246if (!args.TryGetPropertyValue("value", out var valueNode)) 277return Task.FromResult<JsonNode?>(new JsonObject 308if (args == null || !args.TryGetPropertyValue("context", out var contextNode)) 331if (args.TryGetPropertyValue(paramName, out var argNode)) 428if (args != null && args.TryGetPropertyValue(paramName, out var argNode)) 538public async Task<JsonNode?> InvokeAsync(string capabilityId, JsonObject? args) 623public JsonNode? Invoke(string capabilityId, JsonObject? args) 753JsonNode? argNode, 796JsonNode? argNode, 938private static bool IsRejectedEnumString(JsonNode? node, Type unionMemberType) 946private static string DescribeJsonNode(JsonNode? node) 1030if (!args.TryGetPropertyValue(name, out var node) || node is not JsonValue value) 1044if (args.TryGetPropertyValue(name, out var node) && node is JsonValue value) 1056if (args.TryGetPropertyValue(name, out var node) && node is JsonValue value) 1072if (!args.TryGetPropertyValue(name, out var node)) 1099if (args.TryGetPropertyValue(name, out var node) && node is JsonObject obj)
Ats\HandleRegistry.cs (3)
196public static HandleRef? FromJsonNode(JsonNode? node) 198if (node is JsonObject obj && obj.TryGetPropertyValue("$handle", out var handleNode)) 212public static bool IsHandleRef(JsonNode? node)
Ats\PolyglotCapabilityInvocationException.cs (2)
259if (!args.TryGetPropertyValue(targetParameterName, out var targetNode)) 268private static string? TryGetResourceName(JsonNode? node, HandleRegistry handles)
Ats\ReferenceExpressionRef.cs (16)
50public JsonNode?[]? ValueProviders { get; init; } 53public JsonNode? Condition { get; init; } 54public JsonNode? WhenTrue { get; init; } 55public JsonNode? WhenFalse { get; init; } 69public static ReferenceExpressionRef? FromJsonNode(JsonNode? node) 71if (node is not JsonObject obj || !obj.TryGetPropertyValue("$expr", out var exprNode)) 82if (exprObj.TryGetPropertyValue("condition", out var conditionNode)) 84exprObj.TryGetPropertyValue("whenTrue", out var whenTrueNode); 85exprObj.TryGetPropertyValue("whenFalse", out var whenFalseNode); 88if (exprObj.TryGetPropertyValue("matchValue", out var matchValueNode) && 105if (!exprObj.TryGetPropertyValue("format", out var formatNode) || 113JsonNode?[]? valueProviders = null; 114if (exprObj.TryGetPropertyValue("valueProviders", out var providersNode) && 117valueProviders = new JsonNode?[providersArray.Count]; 136public static bool IsReferenceExpressionRef(JsonNode? node) 218var providerNode = ValueProviders[i];
AtsCapabilityScanner.cs (1)
1369private static JsonNode? SerializeExportedValue(object? value, Type memberType)
CodeGeneration\CodeGenerationService.cs (1)
568public System.Text.Json.Nodes.JsonNode? Value { get; set; }
ICallbackInvoker.cs (2)
22Task<TResult> InvokeAsync<TResult>(string callbackId, JsonNode? args, CancellationToken cancellationToken = default); 30Task InvokeAsync(string callbackId, JsonNode? args, CancellationToken cancellationToken = default);
JsonRpcCallbackInvoker.cs (2)
31public async Task<TResult> InvokeAsync<TResult>(string callbackId, JsonNode? args, CancellationToken cancellationToken = default) 55public async Task InvokeAsync(string callbackId, JsonNode? args, CancellationToken cancellationToken = default)
RemoteAppHostService.cs (2)
120public async Task<JsonNode?> InvokeCapabilityAsync(string capabilityId, JsonObject? args) 128var result = await _capabilityDispatcher.InvokeAsync(capabilityId, args).ConfigureAwait(false);
Aspire.Hosting.RemoteHost.Tests (124)
AtsContextFilterTests.cs (1)
595Value = JsonNode.Parse("""{"mode":"Run"}""")
AtsMarshallerTests.cs (27)
124var result = marshaller.MarshalToJson(null); 134var result = marshaller.MarshalToJson("hello"); 145var result = marshaller.MarshalToJson(42); 156var result = marshaller.MarshalToJson(true); 167var result = marshaller.MarshalToJson(TestEnum.ValueB); 178var result = marshaller.MarshalToJson(TimeSpan.FromSeconds(1.5)); 190var result = marshaller.MarshalToJson(array); 208var result = marshaller.MarshalToJson(cts.Token); 229var result = marshaller.MarshalToJson(cts.Token, typeRef); 458var result = marshaller.MarshalToJson(dateOnly); 481var result = marshaller.MarshalToJson(timeOnly); 502var result = marshaller.MarshalToJson(9223372036854775807L); 513var result = marshaller.MarshalToJson(3.14159); 525var result = marshaller.MarshalToJson(guid); 537var result = marshaller.MarshalToJson(list); 556var result = marshaller.MarshalToJson(dict); 575var result = marshaller.MarshalToJson(obj); 771var result = marshaller.MarshalToJson(dto); 826var result = marshaller.MarshalToJson(dto); 919var result = marshaller.MarshalToJson(dto); 935var result = marshaller.MarshalToJson(parent); 955var result = marshaller.MarshalToJson(dto, typeRef); 971var result = marshaller.MarshalToJson(parent); 1242var result = marshaller.MarshalToJson(conditional); 1261var json = marshaller.MarshalToJson(conditional); 1281var json = marshaller.MarshalToJson(conditional); 1300var json = marshaller.MarshalToJson(conditional);
CallbackProxyTests.cs (4)
447public List<(string CallbackId, JsonNode? Args)> Invocations { get; } = []; 448public JsonNode? ResultToReturn { get; set; } 452public Task<TResult> InvokeAsync<TResult>(string callbackId, JsonNode? args, CancellationToken cancellationToken = default) 462public Task InvokeAsync(string callbackId, JsonNode? args, CancellationToken cancellationToken = default)
CapabilityDispatcherTests.cs (85)
18CapabilityHandler handler = (args, handles) => Task.FromResult<JsonNode?>(JsonValue.Create("result")); 37dispatcher.Register("test/cap1@1", (_, _) => Task.FromResult<JsonNode?>(null)); 38dispatcher.Register("test/cap2@1", (_, _) => Task.FromResult<JsonNode?>(null)); 54return Task.FromResult<JsonNode?>(JsonValue.Create("success")); 70return Task.FromResult<JsonNode?>(null); 82dispatcher.Register("test/capability@1", (_, _) => Task.FromResult<JsonNode?>(JsonValue.Create(42))); 84var result = dispatcher.Invoke("test/capability@1", null); 109return Task.FromResult<JsonNode?>(null); 128return Task.FromResult<JsonNode?>(null); 146return Task.FromResult<JsonNode?>(null); 161Task.FromException<JsonNode?>( 186var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/testMethod", args); 198var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withOptional", args); 210var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withOptional", args); 265var nameResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestContextType.name", args); 266var countResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestContextType.count", args); 321var tokenResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestCancellationTokenContext.cancellationToken", getArgs); 327var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/canObserveCancellation", invokeArgs); 382var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestParentContextType.nestedContext", args); 399var operationResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestNestedContextType.operation", nestedArgs); 573var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestTypeWithMethods.calculateSum", args); 593var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestTypeWithMethods.processAsync", args); 613var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestTypeWithMethods.processValueTaskAsync", args); 625var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/asyncValueTaskWithResult", args); 670var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withCallback", args); 736var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withAsyncCallback", args); 748var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/syncInlineThreadProbe", null); 760var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/syncBackgroundThreadProbe", null); 772var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/taskBackgroundThreadProbe", null); 797var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/valueTaskBackgroundThreadProbe", null); 914var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/asyncWithResult", args); 943var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/sumArray", args); 955var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnArray", args); 975var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptReadOnlyList", args); 988var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptUnion", args); 1000var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptUnion", args); 1018var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptDtoUnion", args); 1030var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptEnumStringUnion", args); 1042var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptEnumStringUnion", args); 1083var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptHandleUnion", args); 1135var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null); 1151var listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null); 1162var result = dispatcher.Invoke("Aspire.Hosting/List.get", args); 1174var listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnTypedMutableList", null); 1184var result = dispatcher.Invoke("Aspire.Hosting/List.get", args); 1197var listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null); 1207var removeResult = dispatcher.Invoke("Aspire.Hosting/List.removeAt", removeArgs); 1217var lengthResult = dispatcher.Invoke("Aspire.Hosting/List.length", lengthArgs); 1230var listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null); 1239var result = dispatcher.Invoke("Aspire.Hosting/List.length", args); 1252var listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null); 1268var lengthResult = dispatcher.Invoke("Aspire.Hosting/List.length", lengthArgs); 1281var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null); 1297var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null); 1308var result = dispatcher.Invoke("Aspire.Hosting/Dict.get", args); 1320var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnTypedMutableDict", null); 1330var result = dispatcher.Invoke("Aspire.Hosting/Dict.get", args); 1342var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnIntKeyMutableDict", null); 1352var result = dispatcher.Invoke("Aspire.Hosting/Dict.get", args); 1365var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null); 1375var removeResult = dispatcher.Invoke("Aspire.Hosting/Dict.remove", removeArgs); 1385var countResult = dispatcher.Invoke("Aspire.Hosting/Dict.count", countArgs); 1398var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null); 1408var hasResult = dispatcher.Invoke("Aspire.Hosting/Dict.has", hasArgs); 1419var hasResult2 = dispatcher.Invoke("Aspire.Hosting/Dict.has", hasArgs2); 1432var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null); 1441var result = dispatcher.Invoke("Aspire.Hosting/Dict.keys", args); 1457var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnIntKeyMutableDict", null); 1466var result = dispatcher.Invoke("Aspire.Hosting/Dict.keys", args); 1481var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnIntKeyMutableDict", null); 1501var dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null); 1510var result = dispatcher.Invoke("Aspire.Hosting/Dict.count", args); 1527var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptEnum", args); 1544var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptEnum", args); 1561var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnEnum", args); 1578var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptOptionalEnum", args); 1590var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptOptionalEnum", new JsonObject()); 1679var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithProperties.color", args); 1720var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithMethods.greet", args); 1737var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithProperties.color", args); 1754var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithProperties.name", args); 2097var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/findConnectionPropertyKey", args); 2136public List<(string CallbackId, JsonNode? Args)> Invocations { get; } = []; 2140public Task<TResult> InvokeAsync<TResult>(string callbackId, JsonNode? args, CancellationToken cancellationToken = default) 2148public Task InvokeAsync(string callbackId, JsonNode? args, CancellationToken cancellationToken = default)
ReferenceExpressionRefTests.cs (7)
135var valueProviders = new JsonNode?[] 156var valueProviders = new JsonNode?[] 173var valueProviders = new JsonNode?[] 195var valueProviders = new JsonNode?[] 216var valueProviders = new JsonNode?[] 231private sealed class ReferenceExpressionRef_Accessor(string format, JsonNode?[]? valueProviders) 247foreach (var p in valueProviders)
Aspire.Hosting.Seq.Tests (3)
AddSeqTests.cs (3)
92var manifest = await ManifestUtils.GetManifest(seq.Resource); 253var manifest = await ManifestUtils.GetManifest(seq.Resource); 283var manifest = await ManifestUtils.GetManifest(seq.Resource);
Aspire.Hosting.SqlServer.Tests (3)
AddSqlServerTests.cs (3)
129var serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource); 130var dbManifest = await ManifestUtils.GetManifest(db.Resource); 170var serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
Aspire.Hosting.Tests (68)
AddConnectionStringTests.cs (1)
31var connectionStringManifest = await ManifestUtils.GetManifest(connectionStringResource).DefaultTimeout();
AddParameterTests.cs (5)
104var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 156var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 248var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 305var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "val")).DefaultTimeout(); 333var connectionStringManifest = await ManifestUtils.GetManifest(connectionStringResource).DefaultTimeout();
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (2)
324Assert.True(snapshot.Properties.TryGetValue(CustomResourceKnownProperties.Source, out var normalValue)); 327Assert.True(snapshot.Properties.TryGetValue("ConnectionString", out var sensitiveValue));
Backchannel\BackchannelContractTests.cs (5)
368if (propertyType == typeof(JsonNode)) 370return JsonNode.Parse($$"""{ "property": "{{propertyName}}" }""")!; 389if (expected is JsonNode expectedNode && actual is JsonNode actualNode) 413JsonNode node => node.ToJsonString(),
Dashboard\DashboardResourceTests.cs (1)
786var manifest = await ManifestUtils.GetManifestOrNull(dashboard).DefaultTimeout();
Dcp\JsonPatchTests.cs (16)
16var current = JsonNode.Parse("""{"unchanged":1,"removed":2,"replaced":"before"}"""); 17var changed = JsonNode.Parse("""{"unchanged":1,"replaced":"after","added":true}"""); 24Assert.True(JsonNode.DeepEquals(changed, JsonPatch.Apply(current, patch))); 38Assert.True(JsonNode.DeepEquals(changed, JsonPatch.Apply(current, patch))); 56var current = JsonNode.Parse(currentJson); 57var changed = JsonNode.Parse(changedJson); 62Assert.True(JsonNode.DeepEquals(changed, JsonPatch.Apply(current, patch))); 68var current = JsonNode.Parse("""{"a/b":{"m~n":"before"}}"""); 69var changed = JsonNode.Parse("""{"a/b":{"m~n":"after"}}"""); 76Assert.True(JsonNode.DeepEquals(changed, JsonPatch.Apply(current, patch)));
Dcp\TestKubernetesService.cs (1)
351var resultNode = JsonPatch.Apply(JsonSerializer.SerializeToNode(res, resourceType), jsonPatch);
ExecutableResourceTests.cs (1)
68var manifest = await ManifestUtils.GetManifest(exe2.Resource).DefaultTimeout();
ExternalServiceTests.cs (1)
490var manifest = await ManifestUtils.GetManifest(project.Resource);
KestrelConfigTests.cs (4)
177var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 219var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 288var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 308var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
ManifestGenerationTests.cs (5)
104var redisManifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout(); 547var manifest = await ManifestUtils.GetManifest(param.Resource).DefaultTimeout(); 573var destManifest = await ManifestUtils.GetManifest(destContainer.Resource).DefaultTimeout(); 616var destManifest = await ManifestUtils.GetManifest(destContainer.Resource).DefaultTimeout(); 667var destManifest = await ManifestUtils.GetManifest(destContainer.Resource).DefaultTimeout();
Orchestrator\ParameterProcessorTests.cs (8)
1152Assert.True(capturingStateManager.State.TryGetPropertyValue($"Parameters:{parameter.Name}", out var savedValueNode)); 1185Assert.True(capturingStateManager.State.TryGetPropertyValue($"Parameters:{parameter.Name}", out var savedValueNode)); 1426Assert.True(capturingStateManager.State.TryGetPropertyValue("ConnectionStrings:mydb", out var valueNode)); 1467Assert.True(capturingStateManager.State.TryGetPropertyValue("Parameters:myparam", out var valueNode)); 1511Assert.True(capturingStateManager.State.TryGetPropertyValue("MyCustomSection:MyCustomKey", out var valueNode)); 1550Assert.True(capturingStateManager.State.TryGetPropertyValue($"Parameters:{parameter.Name}", out var savedValueNode)); 1568Assert.True(capturingStateManager.State.TryGetPropertyValue($"Parameters:{parameter.Name}", out var savedValueNode)); 1664var sectionData = _unflattenedState.TryGetPropertyValue(sectionName, out var sectionNode) && sectionNode is JsonObject obj
ProjectResourceTests.cs (2)
601var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 649var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
PublishAsConnectionStringTests.cs (1)
24var manifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout();
PublishAsDockerfileTests.cs (5)
31var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 77var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 126var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 175var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 235var manifest = await ManifestUtils.GetManifest(project.Resource, manifestDirectory: path).DefaultTimeout();
WithEndpointTests.cs (10)
450var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 478var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 505var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 532var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 559var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 586var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 613var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 644var manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout(); 712var manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout(); 867var manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout();
Aspire.Hosting.TestUtilities (14)
Utils\ManifestUtils.cs (14)
13public static async Task<JsonNode> GetManifest(IResource resource, string? manifestDirectory = null) 15var node = await GetManifestOrNull(resource, manifestDirectory); 20public static async Task<JsonNode?> GetManifestOrNull(IResource resource, string? manifestDirectory = null) 39var obj = JsonNode.Parse(ms); 41var resourceNode = obj[resource.Name]; 45public static async Task<JsonNode> GetManifestForModel(DistributedApplicationModel model, string? manifestDirectory = null) 61var obj = JsonNode.Parse(ms); 66public static async Task<JsonNode[]> GetManifests(IResource[] resources) 77var results = new List<JsonNode>(); 86var obj = JsonNode.Parse(ms); 88var resourceNode = obj[r.Name];
Aspire.Hosting.Valkey.Tests (2)
AddValkeyTests.cs (2)
127var manifest = await ManifestUtils.GetManifest(valkey.Resource); 165var manifest = await ManifestUtils.GetManifest(valkey.Resource);
Aspire.Hosting.Yarp (3)
YarpJsonConfigGeneratorBuilder.cs (3)
84var jsonProxyConfig = jsonObject["ReverseProxy"] = new JsonObject(); 100var node = JsonSerializer.SerializeToNode(route, _serializerOptions); 114var node = JsonSerializer.SerializeToNode(cluster, _serializerOptions);
Aspire.TypeSystem (1)
AtsExportedValueInfo.cs (1)
29public required JsonNode? Value { get; init; }
ConfigurationSchemaGenerator (15)
ConfigSchemaEmitter.cs (15)
119var backupTypeNode = currentNode["type"]; 174var existingValue = propertiesNode[pathSegment]; 240var backupTypeNode = currentNode["type"]; 284var backupPropertyNode = currentNode[property.ConfigurationKeyName]; 315var backupTypeNode = currentNode["type"]; 316var backupContainerNode = currentNode[containerName]; 334private static void RestoreBackup(JsonNode? backupNode, string name, JsonObject parentNode) 449var propertyNodeType = propertyNode["type"]; 718private static void ReplaceNodeWithKeyCasingChange(JsonObject jsonObject, string key, JsonNode value) 729private sealed class SchemaOrderJsonNodeConverter : JsonConverter<JsonNode> 733public override bool CanConvert(Type typeToConvert) => typeof(JsonNode).IsAssignableFrom(typeToConvert) && typeToConvert != typeof(JsonValue); 735public override void Write(Utf8JsonWriter writer, JsonNode? value, JsonSerializerOptions options) 742IEnumerable<KeyValuePair<string, JsonNode>> properties = 756foreach (var item in array) 771public override JsonNode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
ConfigurationSchemaGenerator.Tests (4)
GeneratorTests.cs (4)
1579var actualJson = JsonNode.Parse(actual)!; 1580var expectedJson = JsonNode.Parse(expected)!;
dotnet-aot (4)
parent\dotnet\CliSchema.cs (1)
94var node = s_jsonContext.RootCommandDetails.GetJsonSchemaAsNode(new JsonSchemaExporterOptions());
parent\dotnet\Telemetry\TelemetryDiskLogger.cs (3)
55var root = JsonNode.Parse(jsonText)!; 60activitiesArray.Add(JsonNode.Parse(JsonSerializer.Serialize(CreateActivityJsonModel(activity), s_jsonContext.ActivityModel)));
dotnet-user-jwts (1)
Helpers\SigningKeysHandler.cs (1)
85var toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
Infrastructure.Tests (5)
Pipelines\NixCliPackageTests.cs (3)
216return JsonNode.Parse(contents)?.AsObject() 258Assert.True(obj.TryGetPropertyValue(propertyName, out var value), $"Expected property '{propertyName}'."); 264Assert.True(obj.TryGetPropertyValue(propertyName, out var value), $"Expected property '{propertyName}'.");
Pipelines\NpmCliPackageTests.cs (2)
767return JsonNode.Parse(json)?.AsObject() 783private static string[] GetStringArray(JsonNode? jsonNode)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (8)
Helpers\GenericListOrJsonArrayUtilities.cs (2)
35array[index] = (JsonNode)value; 82array.Insert(index, (JsonNode)value);
Helpers\JsonUtilities.cs (3)
24if (a is JsonNode nodeA && b is JsonNode nodeB) 26return JsonNode.DeepEquals(nodeA, nodeB);
Internal\JsonObjectAdapter.cs (3)
37if (!obj.TryGetPropertyValue(segment, out var valueAsToken)) 98if (!obj.TryGetPropertyValue(segment, out var currentValue)) 129if (!obj.TryGetPropertyValue(segment, out var nextTargetToken))
Microsoft.AspNetCore.OpenApi (67)
Extensions\JsonNodeSchemaExtensions.cs (29)
60/// Note that this method targets <see cref="JsonNode"/> and not <see cref="OpenApiSchema"/> because it is 82/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 84internal static void ApplyValidationAttributes(this JsonNode schema, IEnumerable<Attribute> validationAttributes) 170/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 173internal static void ApplyDefaultValue(this JsonNode schema, object? defaultValue, JsonTypeInfo? jsonTypeInfo) 201/// Note that this method targets <see cref="JsonNode"/> and not <see cref="OpenApiSchema"/> because 205/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 207internal static void ApplyPrimitiveFormats(this JsonNode schema, JsonSchemaExporterContext context) 220/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 222internal static void ApplyRouteConstraints(this JsonNode schema, IEnumerable<IRouteConstraint> constraints) 296/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 299internal static void ApplyParameterInfo(this JsonNode schema, ApiParameterDescription parameterDescription, JsonTypeInfo? jsonTypeInfo) 367enumArray.Add((JsonNode)name); 380&& schema[defaultKey] is JsonNode defaultNode 387var serialized = JsonSerializer.SerializeToNode(enumValue, jsonTypeInfo); 390schema[defaultKey] = (JsonNode)memberName; 425/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 428internal static void MapPolymorphismOptionsToDiscriminator(this JsonNode schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId) 470/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 473internal static void ApplySchemaReferenceId(this JsonNode schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId) 504/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 506internal static bool WillBeComponentized(this JsonNode schema) 508return (schema[OpenApiConstants.SchemaId] is JsonNode schemaIdNode 540/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 542internal static void ApplyNullabilityContextInfo(this JsonNode schema, JsonPropertyInfo propertyInfo) 588/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 589internal static void PruneNullTypeForComponentizedTypes(this JsonNode schema) 614private static JsonSchemaType? MapJsonNodeToSchemaType(JsonNode? jsonNode) 630foreach (var node in jsonArray)
Extensions\OpenApiDocumentExtensions.cs (2)
42Examples = example is JsonNode exampleJson ? [exampleJson] : null, 43Default = defaultAnnotation as JsonNode,
Generated\361d1da7f942c932\OpenApiJsonSchemaContext.GetJsonTypeInfo.g.cs (1)
30if (type == typeof(global::System.Text.Json.Nodes.JsonNode))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\OpenApiJsonSchemaContext.JsonNode.g.cs (8)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>? _JsonNode; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> JsonNode 22get => _JsonNode ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.JsonNode)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> Create_JsonNode(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.JsonNode>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> jsonTypeInfo)) 29jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.JsonNode>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonNodeConverter);
Schemas\OpenApiJsonSchema.Helpers.cs (3)
90private static JsonNode? ReadJsonNode(ref Utf8JsonReader reader) 93private static JsonNode? ReadJsonNode(ref Utf8JsonReader reader, out JsonSchemaType? type) 221var enumValues = ReadList<JsonNode>(ref reader, context);
Schemas\OpenApiJsonSchemaContext.cs (1)
13[JsonSerializable(typeof(JsonNode))]
Services\Schemas\OpenApiSchemaService.cs (23)
236static JsonArray JsonArray(ReadOnlySpan<JsonNode> values) 240foreach (var value in values) 251var schemaAsJsonObject = CreateSchema(type); 276var rawNode = CreateSchema(type); 300&& refDefault is JsonNode defaultNode) 573private JsonNode CreateSchema(Type type) 578var schema = JsonSchemaExporter.GetJsonSchemaAsNode(_jsonSerializerOptions, underlyingType, _configuration); 582private static JsonNode ResolveReferences(JsonNode node, JsonNode rootSchema) 587private static JsonNode ResolveReferencesRecursive(JsonNode node, JsonNode rootSchema) 591if (jsonObject.TryGetPropertyValue(OpenApiConstants.RefKeyword, out var refNode) && 600var resolvedNode = ResolveReference(refString, rootSchema); 622var processedValue = ResolveReferencesRecursive(property.Value, rootSchema); 639var processedValue = ResolveReferencesRecursive(jsonArray[i]!, rootSchema); 654private static JsonNode? ResolveReference(string refPath, JsonNode rootSchema) 671var currentNode = rootSchema; 728private static JsonNode EvaluateReferenceToken(string unescapedReferenceToken, JsonNode currentNode, string fullJsonPointer) 741if (!currentObject.TryGetPropertyValue(unescapedReferenceToken, out var referencedValue) ||
Microsoft.Extensions.AI (1)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
220static JsonNode? JsonElementToJsonNode(JsonElement element) =>
Microsoft.Extensions.AI.Abstractions (73)
Functions\AIFunctionFactory.cs (7)
97/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided, 178/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <paramref name="serializerOptions"/> if provided, or else 268/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided, 357/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <paramref name="serializerOptions"/> if provided, or else 419/// <see cref="JsonDocument"/>, or <see cref="JsonNode"/>, it is deserialized directly. If the argument is anything else unknown, 460/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided, 975JsonNode node => JsonSerializer.Deserialize(node, typeInfo),
Utilities\AIJsonSchemaCreateOptions.cs (2)
25public Func<AIJsonSchemaCreateContext, JsonNode, JsonNode>? TransformSchemaNode { get; init; }
Utilities\AIJsonSchemaTransformOptions.cs (2)
17public Func<AIJsonSchemaTransformContext, JsonNode, JsonNode>? TransformSchemaNode { get; init; }
Utilities\AIJsonUtilities.cs (3)
114JsonNode? jsonNode = JsonSerializer.SerializeToNode(value, jti); 162static void NormalizeJsonNode(JsonNode? node) 167foreach (JsonNode? item in array)
Utilities\AIJsonUtilities.Defaults.cs (2)
72[JsonSerializable(typeof(JsonNode))] 153[JsonSerializable(typeof(JsonNode))]
Utilities\AIJsonUtilities.Schema.Create.cs (36)
122JsonNode parameterSchema = CreateJsonSchemaCore( 145(requiredProperties ??= []).Add((JsonNode)parameterSchemaName); 149JsonNode schema = new JsonObject(); 200JsonNode schema = CreateJsonSchemaCore(type, parameter: null, nullabilityContext: null, description, hasDefaultValue, defaultValue, serializerOptions, inferenceOptions); 223private static JsonNode CreateJsonSchemaCore( 249JsonNode? defaultValueNode = defaultValue is not null 277JsonNode TransformSchemaNode(JsonSchemaExporterContext schemaExporterContext, JsonNode schema) 290if (parameter?.Name is not null && objSchema.TryGetPropertyValue(RefPropertyName, out JsonNode? paramName)) 301objSchema[RefPropertyName] = (JsonNode)refUri; 328obj[TypePropertyName] = new JsonArray { (JsonNode)numericType, (JsonNode)"null" }; 332obj[TypePropertyName] = (JsonNode)numericType; 343if (objSchema.TryGetPropertyValue(TypePropertyName, out JsonNode? typeKeyWord) && 349objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 356objSchema.InsertAtStart(TypePropertyName, new JsonArray { (JsonNode)"string", (JsonNode)"null" }); 364if (objSchema.TryGetPropertyValue(TypePropertyName, out JsonNode? typeKeyWord) && 370objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 378JsonNode? defaultValueNode = JsonSerializer.SerializeToNode(defaultValue, ctx.TypeInfo); 385ConvertSchemaToObject(ref schema).InsertAtStart(DescriptionPropertyName, (JsonNode)localDescription); 391ConvertSchemaToObject(ref schema).InsertAtStart(SchemaPropertyName, (JsonNode)SchemaKeywordUri); 404static JsonObject ConvertSchemaToObject(ref JsonNode schema) 424void ApplyDataAnnotations(ref JsonNode schema, AIJsonSchemaCreateContext ctx) 497JsonNode? minNode = null; 498JsonNode? maxNode = null; 567JsonArray? requiredArray = requiredSchemaObj.TryGetPropertyValue(RequiredPropertyName, out JsonNode? existing) ? 580foreach (JsonNode? entry in requiredArray) 591requiredArray.Add((JsonNode)propertyName); 646JsonNode? notNode = obj[NotPropertyName]; 716if (!schema.TryGetPropertyValue(TypePropertyName, out JsonNode? typeNode)) 729foreach (JsonNode? entry in (JsonArray)typeNode) 786foreach (JsonNode? entry in typeArray) 821private static void InsertAtStart(this JsonObject jsonObject, string key, JsonNode value)
Utilities\AIJsonUtilities.Schema.Transform.cs (21)
32JsonNode? nodeSchema = JsonSerializer.SerializeToNode(schema, JsonContext.Default.JsonElement); 33JsonNode transformedSchema = TransformSchema(nodeSchema, transformOptions); 37private static JsonNode TransformSchema(JsonNode? schema, AIJsonSchemaTransformOptions transformOptions) 43private static JsonNode TransformSchemaCore(JsonNode? schema, AIJsonSchemaTransformOptions transformOptions, List<string>? path) 50schema = new JsonObject { [NotPropertyName] = (JsonNode)true }; 68if (schemaObj.TryGetPropertyValue(PropertiesPropertyName, out JsonNode? props) && props is JsonObject propsObj) 82if (schemaObj.TryGetPropertyValue(ItemsPropertyName, out JsonNode? itemsSchema)) 89if (schemaObj.TryGetPropertyValue(AdditionalPropertiesPropertyName, out JsonNode? additionalProps) && 97if (schemaObj.TryGetPropertyValue(NotPropertyName, out JsonNode? notSchema)) 108if (schemaObj.TryGetPropertyValue(combinatorKeyword, out JsonNode? combinatorSchema) && combinatorSchema is JsonArray combinatorArray) 114JsonNode element = TransformSchemaCore(combinatorArray[i], transformOptions, path); 130schemaObj[AdditionalPropertiesPropertyName] = (JsonNode)false; 138requiredProps.Add((JsonNode)prop.Key); 145schemaObj.TryGetPropertyValue(TypePropertyName, out JsonNode? typeSchema) && 151foreach (JsonNode? typeNode in typeArray) 172schemaObj["type"] = (JsonNode)foundType; 173schemaObj["nullable"] = (JsonNode)true; 178schemaObj.TryGetPropertyValue(DefaultPropertyName, out JsonNode? defaultSchema)) 180string? description = schemaObj.TryGetPropertyValue(DescriptionPropertyName, out JsonNode? descriptionSchema) ? descriptionSchema?.GetValue<string>() : null;
Microsoft.Extensions.AI.Abstractions.Tests (40)
AssertExtensions.cs (1)
141if (!JsonNode.DeepEquals(
Contents\FunctionCallContentTests.cs (8)
93var json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options); 100JsonNode? informationalOnlyValue = null; 101if (jsonObj.TryGetPropertyValue("informationalOnly", out var value1)) 105else if (jsonObj.TryGetPropertyValue("InformationalOnly", out var value2)) 149var json = JsonSerializer.SerializeToNode(original, TestJsonSerializerContext.Default.Options); 167var json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options); 257var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonNode>>(""" 314AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, JsonNode>>("""
test\Shared\JsonSchemaExporter\SchemaTestHelpers.cs (11)
17public static void AssertEqualJsonSchema(JsonNode expectedJsonSchema, JsonNode actualJsonSchema) 19if (!JsonNode.DeepEquals(expectedJsonSchema, actualJsonSchema)) 31public static void AssertDocumentMatchesSchema(JsonNode schema, JsonNode? instance) 52public static void AssertDoesNotMatchSchema(JsonNode schema, JsonNode? instance) 67private static EvaluationResults EvaluateSchemaCore(JsonNode schema, JsonNode? instance) 74private static string FormatJson(JsonNode? node) => 78[JsonSerializable(typeof(JsonNode))]
test\Shared\JsonSchemaExporter\TestData.cs (3)
30JsonNode ITestData.ExpectedJsonSchema { get; } = 31JsonNode.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions) 63JsonNode ExpectedJsonSchema { get; }
test\Shared\JsonSchemaExporter\TestTypes.cs (6)
103yield return new TestData<JsonNode>(JsonNode.Parse("""[{ "x" : 42 }]"""), "true"); 106yield return new TestData<JsonArray>([(JsonNode)1, (JsonNode)2, (JsonNode)3], """{"type":["array","null"]}"""); 1247[JsonSerializable(typeof(JsonNode))]
TestJsonSerializerContext.cs (1)
36[JsonSerializable(typeof(Dictionary<string, JsonNode>))] // Used in Content tests
Utilities\AIJsonUtilitiesTests.cs (10)
100case null when property.PropertyType == typeof(Func<AIJsonSchemaCreateContext, JsonNode, JsonNode>): 101Func<AIJsonSchemaCreateContext, JsonNode, JsonNode> transformer = static (context, schema) => (JsonNode)true; 682JsonNode? schemaAsNode = JsonSerializer.SerializeToNode(schema, options); 695JsonNode? serializedValue = JsonSerializer.SerializeToNode(testData.Value, testData.Type, options); 1830schemaObj.Add("myAwesomeKeyword", (JsonNode)42); 1846if (schemaObj.TryGetPropertyValue("properties", out JsonNode? props)) 1853if (schemaObj.TryGetPropertyValue("type", out JsonNode? type) && type is JsonArray typeArray)
Microsoft.Extensions.AI.Evaluation.Quality (5)
AIToolExtensions.cs (3)
24JsonNode functionJsonNode = 29["functionSchema"] = JsonNode.Parse(function.JsonSchema.GetRawText()), 35JsonNode.Parse(function.ReturnJsonSchema.Value.GetRawText());
ChatMessageExtensions.cs (1)
21JsonNode? messageJsonNode =
ChatResponseExtensions.cs (1)
36JsonNode? toolCallOrResultJsonNode =
Microsoft.Extensions.AI.Evaluation.Safety (4)
EvaluationMetricExtensions.cs (4)
81JsonNode? jsonData = JsonNode.Parse(data); 87Failed to parse supplied {nameof(data)} below into a {nameof(JsonNode)}. 97internal static void LogJsonData(this EvaluationMetric metric, JsonNode data)
Microsoft.Extensions.AI.Integration.Tests (5)
VerbatimHttpHandler.cs (5)
108JsonNode? expectedNode = null; 109JsonNode? actualNode = null; 112expectedNode = JsonNode.Parse(expected); 113actualNode = JsonNode.Parse(actual); 121if (!JsonNode.DeepEquals(expectedNode, actualNode))
Microsoft.Extensions.AI.OpenAI (1)
OpenAIClientExtensions.cs (1)
98static void AppendLine(ref StringBuilder? sb, string propName, JsonNode propNode)
Microsoft.Extensions.AI.OpenAI.Tests (1)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (1)
141if (!JsonNode.DeepEquals(
Microsoft.Extensions.AI.Tests (3)
Functions\AIFunctionFactoryTest.cs (1)
138["y"] = JsonNode.Parse("2"),
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (1)
141if (!JsonNode.DeepEquals(
TestJsonSerializerContext.cs (1)
23[JsonSerializable(typeof(Dictionary<string, JsonNode>))]
Microsoft.ML.AutoML (12)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (3)
17var jValue = JsonValue.Parse(ref reader); 26var jsonObject = JsonNode.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
18var jsonObject = JsonValue.Parse(ref reader); 29var jObject = JsonObject.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (4)
17var jNode = JsonNode.Parse(ref reader); 29var jNode = JsonNode.Parse("{}");
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
17var jValue = JsonValue.Parse(ref reader); 27var jsonObject = JsonNode.Parse("{}");
Microsoft.ML.AutoML.SourceGenerator (5)
SearchSpaceGenerator.cs (5)
35var searchSpacesJNodes = searchSpacesJson.Select(x => JsonNode.Parse(x)); 37foreach (var jNode in searchSpacesJNodes) 65var defaultToken = t.AsObject().ContainsKey("default") ? t["default"] : null; 86var searchSpaceNode = t.AsObject().ContainsKey("search_space") ? t["search_space"] : null; 96var minToken = searchSpaceNode["min"];
Microsoft.NET.Build.Containers (17)
ImageConfig.cs (9)
44internal ImageConfig(string imageConfigJson) : this(JsonNode.Parse(imageConfigJson)!) 48internal ImageConfig(JsonNode config) 129if (_config["config"]?[propertyName] is JsonNode propertyValue) 134newConfig[propertyName] = JsonNode.Parse(propertyValue.ToJsonString()); 163["history"] = new JsonArray(_history.Select(CreateHistory).ToArray<JsonNode>()) 168static JsonArray ToJsonArray(IEnumerable<string> items) => new(items.Where(s => !string.IsNullOrEmpty(s)).Select(s => JsonValue.Create(s)).ToArray<JsonNode?>()); 249foreach (KeyValuePair<string, JsonNode?> property in portsJson) 268foreach (KeyValuePair<string, JsonNode?> property in labelsJson) 284foreach (JsonNode? entry in envVarJson)
LocalDaemons\ContainerArchive.cs (1)
165JsonNode manifestNode = new JsonArray(
LocalDaemons\DockerCli.cs (1)
391JsonNode manifestNode = new JsonArray(new JsonObject
Registry\DefaultBlobOperations.cs (3)
43public async Task<JsonNode> GetJsonAsync(string repositoryName, string digest, CancellationToken cancellationToken) 48JsonNode? configDoc = JsonNode.Parse(await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false));
Registry\IBlobOperations.cs (1)
20public Task<JsonNode> GetJsonAsync(string repositoryName, string digest, CancellationToken cancellationToken);
Registry\Registry.cs (1)
257JsonNode configDoc = await _registryAPI.Blob.GetJsonAsync(repositoryName, configSha, cancellationToken).ConfigureAwait(false);
Tasks\CreateImageIndex.cs (1)
145var configJson = JsonNode.Parse(config) as JsonObject;
Microsoft.NET.Build.Tasks (9)
GenerateRuntimeConfigurationFiles.cs (7)
295JsonObject runtimeOptionsFromProject = (JsonObject)JsonNode.Parse( 299foreach (KeyValuePair<string, JsonNode> runtimeOption in runtimeOptionsFromProject) 322if (!runtimeOptions.RawOptions.TryGetValue("configProperties", out JsonNode configProperties) 332private static JsonNode GetConfigPropertyValue(ITaskItem hostConfigurationOption) 472probingPaths.Add((JsonNode)probingPath); 481foreach (KeyValuePair<string, JsonNode> rawOption in runtimeOptions.RawOptions) 497array.Add((JsonNode)SerializeFramework(framework));
RuntimeOptions.cs (2)
24public IDictionary<string, JsonNode> RawOptions { get; } = new Dictionary<string, JsonNode>();
Microsoft.NETCore.Platforms (2)
UpdateRuntimeIdentifierGraph.cs (2)
26JsonNode? json; 29json = JsonNode.Parse(stream);
Microsoft.TemplateEngine.Cli (52)
Alias\AliasRegistry.cs (4)
156arr.Add((JsonNode)JsonValue.Create(item)!); 180JsonNode? element = null; 195foreach (KeyValuePair<string, JsonNode?> property in jObj) 208foreach (JsonNode? item in arr)
HostSpecificDataLoader.cs (2)
48JsonObject? jObject = JsonNode.Parse(hostData, nodeOptions: null, s_jsonDocumentOptions)?.AsObject(); 72jsonData = JsonNode.Parse(stream, nodeOptions: null, s_jsonDocumentOptions)?.AsObject();
HostSpecificTemplateData.cs (5)
28JsonNode? usagesNode = GetPropertyCaseInsensitive(jObject, nameof(UsageExamples)); 36JsonNode? symbolsNode = GetPropertyCaseInsensitive(jObject, nameof(SymbolInfo)); 72JsonNode? isHiddenNode = GetPropertyCaseInsensitive(jObject, nameof(IsHidden)); 190private static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key) 192if (obj.TryGetPropertyValue(key, out JsonNode? result))
JExtensions.cs (28)
19internal static string? ToString(this JsonNode? token, string? key) 41JsonNode? element = GetPropertyCaseInsensitive(obj, key); 50internal static bool TryGetValue(this JsonNode? token, string? key, out JsonNode? result) 75internal static bool TryParseBool(this JsonNode token, out bool result) 96internal static bool ToBool(this JsonNode? token, string? key = null, bool defaultValue = false) 98if (!token.TryGetValue(key, out JsonNode? checkToken)) 111internal static int ToInt32(this JsonNode? token, string? key = null, int defaultValue = 0) 128JsonNode? element = GetPropertyCaseInsensitive(obj, key); 137internal static T ToEnum<T>(this JsonNode token, string? key = null, T defaultValue = default) 149internal static Guid ToGuid(this JsonNode token, string? key = null, Guid defaultValue = default) 160internal static IEnumerable<KeyValuePair<string, JsonNode?>> PropertiesOf(this JsonNode? token, string? key = null) 164return Array.Empty<KeyValuePair<string, JsonNode?>>(); 169JsonNode? element = GetPropertyCaseInsensitive(currentJObj, key); 172return Array.Empty<KeyValuePair<string, JsonNode?>>(); 180internal static T? Get<T>(this JsonNode? token, string? key) 181where T : JsonNode 188JsonNode? res = GetPropertyCaseInsensitive(obj, key); 192internal static IReadOnlyList<string> ArrayAsStrings(this JsonNode? token, string? propertyName = null) 206foreach (JsonNode? item in arr) 222return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 226internal static void WriteObject(this IPhysicalFileSystem fileSystem, string path, JsonNode obj) 233internal static bool TryParse(this string arg, out JsonNode? token) 237token = JsonNode.Parse(arg, null, DocOptions); 247private static bool TryParseInt(this JsonNode token, out int result) 267private static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key) 269if (obj.TryGetPropertyValue(key, out JsonNode? result))
PostActionProcessors\AddJsonPropertyPostActionProcessor.cs (10)
152JsonNode? newJsonContent = AddElementToJson( 173private static JsonNode? AddElementToJson(IPhysicalFileSystem fileSystem, string targetJsonFile, string? propertyPath, string propertyPathSeparator, string newJsonPropertyName, string newJsonPropertyValue, IPostAction action) 176JsonNode? jsonContent = JsonNode.Parse(fileContent, nodeOptions: null, documentOptions: DeserializerOptions); 190JsonNode? parentProperty = FindJsonNode(jsonContent, propertyPath, propertyPathSeparator, createPath); 200parentProperty[newJsonPropertyName] = JsonNode.Parse(newJsonPropertyValue); 210private static JsonNode? FindJsonNode(JsonNode content, string? nodePath, string pathSeparator, bool createPath) 219JsonNode? node = content; 228JsonNode? childNode = node[property];
PostActionProcessors\ChmodPostActionProcessor.cs (1)
25JsonArray valueArray = JsonNode.Parse(entry.Value)!.AsArray();
PostActionProcessors\PostActionProcessorBase.cs (1)
126targetFiles.TryParse(out JsonNode? config);
TemplateSearch\CliHostSearchCacheData.cs (1)
36foreach (KeyValuePair<string, JsonNode?> data in cacheObject)
Microsoft.TemplateEngine.Edge (80)
BuiltInManagedProvider\GlobalSettings.cs (1)
86foreach (var package in jObject.Get<JsonArray>(nameof(GlobalSettingsData.Packages)) ?? new JsonArray())
Constraints\ConstraintsExtensions.cs (6)
20JsonNode token = ParseConstraintJsonNode(args); 54JsonNode token = ParseConstraintJsonNode(args); 113private static JsonNode ParseConstraintJsonNode(this string? args) 120JsonNode? token; 123token = JsonNode.Parse(args!); 133private static JsonArray ToConstraintsJsonArray(this JsonNode token, string? args, bool isStringTypeAllowed)
parent\Shared\JExtensions.cs (57)
27internal static string? ToString(this JsonNode? token, string? key) 49JsonNode? element = GetPropertyCaseInsensitive(obj, key); 63internal static bool TryGetValue(this JsonNode? token, string? key, out JsonNode? result) 88internal static bool TryParseBool(this JsonNode token, out bool result) 109internal static bool ToBool(this JsonNode? token, string? key = null, bool defaultValue = false) 111if (!token.TryGetValue(key, out JsonNode? checkToken)) 124internal static bool TryParseInt(this JsonNode token, out int result) 144internal static int ToInt32(this JsonNode? token, string? key = null, int defaultValue = 0) 161JsonNode? element = GetPropertyCaseInsensitive(obj, key); 170internal static T ToEnum<T>(this JsonNode token, string? key = null, T defaultValue = default, bool ignoreCase = false) 182internal static Guid ToGuid(this JsonNode token, string? key = null, Guid defaultValue = default) 200JsonNode? token = jObject.Get<JsonNode>(propertyName); 208internal static IEnumerable<KeyValuePair<string, JsonNode?>> PropertiesOf(this JsonNode? token, string? key = null) 217JsonNode? element = GetPropertyCaseInsensitive(obj, key); 236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj) 256/// when the internal dictionary has not yet been initialized, so <see cref="JsonNode.ToJsonString"/> is 260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj) 263var result = new List<KeyValuePair<string, JsonNode?>>(); 268var property = new KeyValuePair<string, JsonNode?>(prop.Name, ParseJsonNode(prop.Value.GetRawText())); 282internal static T? Get<T>(this JsonNode? token, string? key) 283where T : JsonNode 290JsonNode? res = GetPropertyCaseInsensitive(obj, key); 294internal static IReadOnlyDictionary<string, string> ToStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 315internal static IReadOnlyDictionary<string, JsonNode> ToJsonNodeDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 317Dictionary<string, JsonNode> result = new(comparer ?? StringComparer.Ordinal); 334internal static IReadOnlyDictionary<string, string> ToJsonNodeStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 349internal static TemplateParameterPrecedence ToTemplateParameterPrecedence(this JsonNode jObject, string? key) 351if (!jObject.TryGetValue(key, out JsonNode? checkToken)) 364internal static IReadOnlyList<string> ArrayAsStrings(this JsonNode? token, string? propertyName = null) 378foreach (JsonNode? item in arr) 389internal static IReadOnlyList<Guid> ArrayAsGuids(this JsonNode? token, string? propertyName = null) 403foreach (JsonNode? item in arr) 417internal static IEnumerable<T> Items<T>(this JsonNode? token, string? propertyName = null) 418where T : JsonNode 430foreach (JsonNode? item in arr) 444return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 453return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 463internal static IReadOnlyList<string> JTokenStringOrArrayToCollection(this JsonNode? token, IReadOnlyList<string> defaultSet) 503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result) 513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key) 518if (obj.TryGetPropertyValue(key, out JsonNode? result)) 546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key) 551JsonNode? result = null; 552JsonNode? caseInsensitiveResult = null; 576return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 583internal static JsonNode? ParseJsonNode(string json) 585return JsonNode.Parse(json, null, DocOptions); 599return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions) 624&& target.TryGetPropertyValue(property.Key, out JsonNode? targetNode) 635foreach (var item in sourceArr) 637targetArr.Add(item != null ? JsonNode.Parse(item.ToJsonString()) : null); 644? JsonNode.Parse(property.Value.ToJsonString())
Settings\SettingsStore.cs (5)
21if (obj.TryGetValueCaseInsensitive(nameof(ComponentGuidToAssemblyQualifiedName), out JsonNode? componentGuidToAssemblyQualifiedNameToken)) 35if (obj.TryGetValueCaseInsensitive(nameof(ProbingPaths), out JsonNode? probingPathsToken)) 39foreach (JsonNode? path in probingPathsArray) 49if (obj.TryGetValueCaseInsensitive(nameof(ComponentTypeToGuidList), out JsonNode? componentTypeToGuidListToken)) 60foreach (JsonNode? value in values)
Settings\TemplateCache.cs (5)
76if (contentJObject != null && contentJObject.TryGetValueCaseInsensitive(nameof(Version), out JsonNode? versionToken)) 89Locale = contentJObject.TryGetValueCaseInsensitive(nameof(Locale), out JsonNode? localeToken) 95if (contentJObject.TryGetValueCaseInsensitive(nameof(MountPointsInfo), out JsonNode? mountPointInfoToken) && mountPointInfoToken is JsonObject mountPointInfoObj) 110if (contentJObject.TryGetValueCaseInsensitive(nameof(TemplateInfo), out JsonNode? templateInfoToken) && templateInfoToken is JsonArray arr) 112foreach (JsonNode? entry in arr)
Settings\TemplateInfoReader.cs (6)
23JsonNode? shortNameToken = entry.Get<JsonNode>(nameof(ShortNameList)); 34foreach (JsonNode? item in classificationsArray) 80foreach (JsonNode? item in parametersArray) 109foreach (JsonNode? item in postActionsArray) 124foreach (JsonNode? item in constraintsArray)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (87)
ConfigModel\BaseValueSymbol.cs (4)
23if (!jObject.TryGetValue(nameof(Forms), out JsonNode? formsToken) || formsToken is not JsonObject formsObject) 72private protected bool TryGetIsRequiredField(JsonNode token, out bool result) 81private bool ParseIsRequiredField(JsonNode token, bool throwOnError) 83if (!token.TryGetValue(nameof(IsRequired), out JsonNode? isRequiredToken))
ConfigModel\CustomFileGlobModel.cs (2)
44if (globData.TryGetValue(nameof(Operations), out JsonNode? operationData)) 46foreach (JsonNode? operationConfig in (JsonArray)operationData!)
ConfigModel\ParameterSymbol.cs (3)
198if (jObject != null && jObject.TryGetValue("IsEnabled", out JsonNode? isEnabledToken)) 246private static string? ParseIsRequiredConditionField(JsonNode token) 248if (!token.TryGetValue(nameof(IsRequired), out JsonNode? isRequiredToken))
ConfigModel\PostActionModel.cs (2)
90JsonNode? action = jArray[postActionIndex]; 191JsonNode? jToken = jArray[i];
ConfigModel\PrimaryOutputModel.cs (1)
39foreach (JsonNode? pathInfo in jsonData)
ConfigModel\ReplacementContext.cs (1)
38foreach (JsonNode? entry in onlyIf)
ConfigModel\SymbolValueFormsModel.cs (1)
35JsonNode? globalConfig = JExtensions.GetPropertyCaseInsensitive(configJson, "global");
ConfigModel\TemplateConfigModel.cs (8)
158JsonNode? globalCustomConfigData = JExtensions.GetPropertyCaseInsensitive(source, nameof(GlobalCustomOperations)); 165IReadOnlyDictionary<string, JsonNode> allSpecialOpsConfig = source.ToJsonNodeDictionary(StringComparer.OrdinalIgnoreCase, nameof(SpecialCustomOperations)); 168foreach (KeyValuePair<string, JsonNode> globConfigKeyValue in allSpecialOpsConfig) 171JsonNode globData = globConfigKeyValue.Value; 194obj.TryGetValue(nameof(TemplateConstraintInfo.Args), out JsonNode? args); 542IReadOnlyDictionary<string, JsonNode> templateDefinedForms = source.ToJsonNodeDictionary(StringComparer.OrdinalIgnoreCase, nameof(Forms)); 544foreach (KeyValuePair<string, JsonNode> form in templateDefinedForms) 554private static IReadOnlyDictionary<string, IBaselineInfo> BaselineInfoFromJObject(IEnumerable<KeyValuePair<string, JsonNode?>> baselineProperties)
Macros\BaseMacroConfig.cs (4)
88var jToken = JExtensions.ParseJsonNode(token); 105var jToken = JExtensions.ParseJsonNode(token); 122var jToken = JExtensions.ParseJsonNode(token); 139var jToken = JExtensions.ParseJsonNode(token);
Macros\JoinMacroConfig.cs (1)
34foreach (JsonNode? entry in jArray)
Macros\RegexMacroConfig.cs (1)
36foreach (JsonNode? entry in jArray)
Macros\SwitchMacroConfig.cs (1)
35foreach (JsonNode? entry in jArray)
OperationConfig\ReplacementConfig.cs (1)
34foreach (JsonNode? entry in onlyIf)
parent\Shared\JExtensions.cs (57)
27internal static string? ToString(this JsonNode? token, string? key) 49JsonNode? element = GetPropertyCaseInsensitive(obj, key); 63internal static bool TryGetValue(this JsonNode? token, string? key, out JsonNode? result) 88internal static bool TryParseBool(this JsonNode token, out bool result) 109internal static bool ToBool(this JsonNode? token, string? key = null, bool defaultValue = false) 111if (!token.TryGetValue(key, out JsonNode? checkToken)) 124internal static bool TryParseInt(this JsonNode token, out int result) 144internal static int ToInt32(this JsonNode? token, string? key = null, int defaultValue = 0) 161JsonNode? element = GetPropertyCaseInsensitive(obj, key); 170internal static T ToEnum<T>(this JsonNode token, string? key = null, T defaultValue = default, bool ignoreCase = false) 182internal static Guid ToGuid(this JsonNode token, string? key = null, Guid defaultValue = default) 200JsonNode? token = jObject.Get<JsonNode>(propertyName); 208internal static IEnumerable<KeyValuePair<string, JsonNode?>> PropertiesOf(this JsonNode? token, string? key = null) 217JsonNode? element = GetPropertyCaseInsensitive(obj, key); 236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj) 256/// when the internal dictionary has not yet been initialized, so <see cref="JsonNode.ToJsonString"/> is 260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj) 263var result = new List<KeyValuePair<string, JsonNode?>>(); 268var property = new KeyValuePair<string, JsonNode?>(prop.Name, ParseJsonNode(prop.Value.GetRawText())); 282internal static T? Get<T>(this JsonNode? token, string? key) 283where T : JsonNode 290JsonNode? res = GetPropertyCaseInsensitive(obj, key); 294internal static IReadOnlyDictionary<string, string> ToStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 315internal static IReadOnlyDictionary<string, JsonNode> ToJsonNodeDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 317Dictionary<string, JsonNode> result = new(comparer ?? StringComparer.Ordinal); 334internal static IReadOnlyDictionary<string, string> ToJsonNodeStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 349internal static TemplateParameterPrecedence ToTemplateParameterPrecedence(this JsonNode jObject, string? key) 351if (!jObject.TryGetValue(key, out JsonNode? checkToken)) 364internal static IReadOnlyList<string> ArrayAsStrings(this JsonNode? token, string? propertyName = null) 378foreach (JsonNode? item in arr) 389internal static IReadOnlyList<Guid> ArrayAsGuids(this JsonNode? token, string? propertyName = null) 403foreach (JsonNode? item in arr) 417internal static IEnumerable<T> Items<T>(this JsonNode? token, string? propertyName = null) 418where T : JsonNode 430foreach (JsonNode? item in arr) 444return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 453return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 463internal static IReadOnlyList<string> JTokenStringOrArrayToCollection(this JsonNode? token, IReadOnlyList<string> defaultSet) 503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result) 513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key) 518if (obj.TryGetPropertyValue(key, out JsonNode? result)) 546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key) 551JsonNode? result = null; 552JsonNode? caseInsensitiveResult = null; 576return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 583internal static JsonNode? ParseJsonNode(string json) 585return JsonNode.Parse(json, null, DocOptions); 599return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions) 624&& target.TryGetPropertyValue(property.Key, out JsonNode? targetNode) 635foreach (var item in sourceArr) 637targetArr.Add(item != null ? JsonNode.Parse(item.ToJsonString()) : null); 644? JsonNode.Parse(property.Value.ToJsonString())
Microsoft.TemplateEngine.Utils (57)
parent\Shared\JExtensions.cs (57)
27internal static string? ToString(this JsonNode? token, string? key) 49JsonNode? element = GetPropertyCaseInsensitive(obj, key); 63internal static bool TryGetValue(this JsonNode? token, string? key, out JsonNode? result) 88internal static bool TryParseBool(this JsonNode token, out bool result) 109internal static bool ToBool(this JsonNode? token, string? key = null, bool defaultValue = false) 111if (!token.TryGetValue(key, out JsonNode? checkToken)) 124internal static bool TryParseInt(this JsonNode token, out int result) 144internal static int ToInt32(this JsonNode? token, string? key = null, int defaultValue = 0) 161JsonNode? element = GetPropertyCaseInsensitive(obj, key); 170internal static T ToEnum<T>(this JsonNode token, string? key = null, T defaultValue = default, bool ignoreCase = false) 182internal static Guid ToGuid(this JsonNode token, string? key = null, Guid defaultValue = default) 200JsonNode? token = jObject.Get<JsonNode>(propertyName); 208internal static IEnumerable<KeyValuePair<string, JsonNode?>> PropertiesOf(this JsonNode? token, string? key = null) 217JsonNode? element = GetPropertyCaseInsensitive(obj, key); 236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj) 256/// when the internal dictionary has not yet been initialized, so <see cref="JsonNode.ToJsonString"/> is 260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj) 263var result = new List<KeyValuePair<string, JsonNode?>>(); 268var property = new KeyValuePair<string, JsonNode?>(prop.Name, ParseJsonNode(prop.Value.GetRawText())); 282internal static T? Get<T>(this JsonNode? token, string? key) 283where T : JsonNode 290JsonNode? res = GetPropertyCaseInsensitive(obj, key); 294internal static IReadOnlyDictionary<string, string> ToStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 315internal static IReadOnlyDictionary<string, JsonNode> ToJsonNodeDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 317Dictionary<string, JsonNode> result = new(comparer ?? StringComparer.Ordinal); 334internal static IReadOnlyDictionary<string, string> ToJsonNodeStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 349internal static TemplateParameterPrecedence ToTemplateParameterPrecedence(this JsonNode jObject, string? key) 351if (!jObject.TryGetValue(key, out JsonNode? checkToken)) 364internal static IReadOnlyList<string> ArrayAsStrings(this JsonNode? token, string? propertyName = null) 378foreach (JsonNode? item in arr) 389internal static IReadOnlyList<Guid> ArrayAsGuids(this JsonNode? token, string? propertyName = null) 403foreach (JsonNode? item in arr) 417internal static IEnumerable<T> Items<T>(this JsonNode? token, string? propertyName = null) 418where T : JsonNode 430foreach (JsonNode? item in arr) 444return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 453return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 463internal static IReadOnlyList<string> JTokenStringOrArrayToCollection(this JsonNode? token, IReadOnlyList<string> defaultSet) 503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result) 513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key) 518if (obj.TryGetPropertyValue(key, out JsonNode? result)) 546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key) 551JsonNode? result = null; 552JsonNode? caseInsensitiveResult = null; 576return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 583internal static JsonNode? ParseJsonNode(string json) 585return JsonNode.Parse(json, null, DocOptions); 599return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions) 624&& target.TryGetPropertyValue(property.Key, out JsonNode? targetNode) 635foreach (var item in sourceArr) 637targetArr.Add(item != null ? JsonNode.Parse(item.ToJsonString()) : null); 644? JsonNode.Parse(property.Value.ToJsonString())
Microsoft.TemplateSearch.Common (76)
parent\Shared\JExtensions.cs (57)
27internal static string? ToString(this JsonNode? token, string? key) 49JsonNode? element = GetPropertyCaseInsensitive(obj, key); 63internal static bool TryGetValue(this JsonNode? token, string? key, out JsonNode? result) 88internal static bool TryParseBool(this JsonNode token, out bool result) 109internal static bool ToBool(this JsonNode? token, string? key = null, bool defaultValue = false) 111if (!token.TryGetValue(key, out JsonNode? checkToken)) 124internal static bool TryParseInt(this JsonNode token, out int result) 144internal static int ToInt32(this JsonNode? token, string? key = null, int defaultValue = 0) 161JsonNode? element = GetPropertyCaseInsensitive(obj, key); 170internal static T ToEnum<T>(this JsonNode token, string? key = null, T defaultValue = default, bool ignoreCase = false) 182internal static Guid ToGuid(this JsonNode token, string? key = null, Guid defaultValue = default) 200JsonNode? token = jObject.Get<JsonNode>(propertyName); 208internal static IEnumerable<KeyValuePair<string, JsonNode?>> PropertiesOf(this JsonNode? token, string? key = null) 217JsonNode? element = GetPropertyCaseInsensitive(obj, key); 236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj) 256/// when the internal dictionary has not yet been initialized, so <see cref="JsonNode.ToJsonString"/> is 260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj) 263var result = new List<KeyValuePair<string, JsonNode?>>(); 268var property = new KeyValuePair<string, JsonNode?>(prop.Name, ParseJsonNode(prop.Value.GetRawText())); 282internal static T? Get<T>(this JsonNode? token, string? key) 283where T : JsonNode 290JsonNode? res = GetPropertyCaseInsensitive(obj, key); 294internal static IReadOnlyDictionary<string, string> ToStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 315internal static IReadOnlyDictionary<string, JsonNode> ToJsonNodeDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 317Dictionary<string, JsonNode> result = new(comparer ?? StringComparer.Ordinal); 334internal static IReadOnlyDictionary<string, string> ToJsonNodeStringDictionary(this JsonNode token, StringComparer? comparer = null, string? propertyName = null) 349internal static TemplateParameterPrecedence ToTemplateParameterPrecedence(this JsonNode jObject, string? key) 351if (!jObject.TryGetValue(key, out JsonNode? checkToken)) 364internal static IReadOnlyList<string> ArrayAsStrings(this JsonNode? token, string? propertyName = null) 378foreach (JsonNode? item in arr) 389internal static IReadOnlyList<Guid> ArrayAsGuids(this JsonNode? token, string? propertyName = null) 403foreach (JsonNode? item in arr) 417internal static IEnumerable<T> Items<T>(this JsonNode? token, string? propertyName = null) 418where T : JsonNode 430foreach (JsonNode? item in arr) 444return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 453return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 463internal static IReadOnlyList<string> JTokenStringOrArrayToCollection(this JsonNode? token, IReadOnlyList<string> defaultSet) 503internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result) 513internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key) 518if (obj.TryGetPropertyValue(key, out JsonNode? result)) 546private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key) 551JsonNode? result = null; 552JsonNode? caseInsensitiveResult = null; 576return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 583internal static JsonNode? ParseJsonNode(string json) 585return JsonNode.Parse(json, null, DocOptions); 599return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 608return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions) 624&& target.TryGetPropertyValue(property.Key, out JsonNode? targetNode) 635foreach (var item in sourceArr) 637targetArr.Add(item != null ? JsonNode.Parse(item.ToJsonString()) : null); 644? JsonNode.Parse(property.Value.ToJsonString())
TemplateDiscoveryMetadata\BlobStorageTemplateInfo.cs (5)
155JsonNode? shortNameToken = entry.Get<JsonNode>(nameof(ShortNameList)); 167foreach (JsonNode? item in classificationsArray) 198foreach (JsonNode? item in postActionsArray) 214foreach (JsonNode? item in parametersArray)
TemplateDiscoveryMetadata\LegacySearchCacheReader.cs (10)
84if (cacheObject.TryGetValueCaseInsensitive(nameof(TemplateDiscoveryMetadata.Version), out JsonNode? value)) 104if (cacheObject.TryGetValueCaseInsensitive(nameof(TemplateDiscoveryMetadata.TemplateCache), out JsonNode? templateInfoToken)) 110foreach (JsonNode? entry in arr) 148JsonNode? packToTemplateMapToken = JExtensions.GetPropertyCaseInsensitive(cacheObject, nameof(TemplateDiscoveryMetadata.PackToTemplateMap)); 165JsonNode? versionNode = JExtensions.GetPropertyCaseInsensitive(entryValue, nameof(PackToTemplateEntry.Version)); 166JsonNode? identificationNode = JExtensions.GetPropertyCaseInsensitive(entryValue, nameof(PackToTemplateEntry.TemplateIdentificationEntry)); 173foreach (JsonNode? templateIdentityInfo in identificationArray) 187if (entryValue.TryGetValueCaseInsensitive(nameof(PackToTemplateEntry.TotalDownloads), out JsonNode? totalDownloadsNode) 217JsonNode? additionalDataToken = JExtensions.GetPropertyCaseInsensitive(cacheObject, nameof(TemplateDiscoveryMetadata.AdditionalData)); 232JsonNode? dataNode = JExtensions.GetPropertyCaseInsensitive(additionalDataObject, dataReadInfo.Key);
TemplateSearchCache\TemplatePackageSearchData.Json.cs (2)
33Owners = jObject.Get<JsonNode>(nameof(Owners)).JTokenStringOrArrayToCollection([]); 42foreach (JsonNode? template in templatesData)
TemplateSearchCache\TemplateSearchCache.Json.cs (2)
55foreach (JsonNode? templatePackage in data) 81JsonNode? dataNode = JExtensions.GetPropertyCaseInsensitive(cacheObject, dataReadInfo.Key);
MSBuild (3)
JsonOutputFormatter.cs (3)
20private readonly JsonNode _topLevelNode = new JsonObject(); 36JsonNode propertiesNode = new JsonObject(); 54JsonNode itemsNode = new JsonObject();
sdk-tasks (13)
GetRuntimePackRids.cs (1)
22var runtimeJsonRoot = JsonNode.Parse(runtimeJsonContents)!.AsObject();
PublishMutationUtilities.cs (4)
17var deps = JsonNode.Parse(File.ReadAllText(depsFile)); 29var targetLibraryValue = targetLibrary.Value; 40var libraryValue = library.Value;
RemoveAssetFromDepsPackages.cs (3)
34var deps = JsonNode.Parse(File.ReadAllText(depsFile)); 41var section = pv.Value![sectionName];
UpdateRuntimeConfig.cs (5)
37var config = JsonNode.Parse(text)!.AsObject(); 38var frameworks = config["runtimeOptions"]?["frameworks"]; 39var framework = config["runtimeOptions"]?["framework"]; 42foreach (var item in frameworks.AsArray()) 55private void UpdateFramework(JsonNode item)
Shared.Tests (20)
JsonSchemaExporter\SchemaTestHelpers.cs (11)
17public static void AssertEqualJsonSchema(JsonNode expectedJsonSchema, JsonNode actualJsonSchema) 19if (!JsonNode.DeepEquals(expectedJsonSchema, actualJsonSchema)) 31public static void AssertDocumentMatchesSchema(JsonNode schema, JsonNode? instance) 52public static void AssertDoesNotMatchSchema(JsonNode schema, JsonNode? instance) 67private static EvaluationResults EvaluateSchemaCore(JsonNode schema, JsonNode? instance) 74private static string FormatJson(JsonNode? node) => 78[JsonSerializable(typeof(JsonNode))]
JsonSchemaExporter\TestData.cs (3)
30JsonNode ITestData.ExpectedJsonSchema { get; } = 31JsonNode.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions) 63JsonNode ExpectedJsonSchema { get; }
JsonSchemaExporter\TestTypes.cs (6)
103yield return new TestData<JsonNode>(JsonNode.Parse("""[{ "x" : 42 }]"""), "true"); 106yield return new TestData<JsonArray>([(JsonNode)1, (JsonNode)2, (JsonNode)3], """{"type":["array","null"]}"""); 1247[JsonSerializable(typeof(JsonNode))]
System.Text.Json (475)
System\Text\Json\Nodes\JsonArray.cs (31)
24private List<JsonNode?>? _list; 39public JsonArray(JsonNodeOptions options, params JsonNode?[] items) : base(options) 49public JsonArray(JsonNodeOptions options, params ReadOnlySpan<JsonNode?> items) : base(options) 58public JsonArray(params JsonNode?[] items) : base() 67public JsonArray(params ReadOnlySpan<JsonNode?> items) : base() 74internal override JsonNode DeepCloneCore() 76GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 87_list = new List<JsonNode?>(list.Count) 98internal override bool DeepEqualsCore(JsonNode node) 108List<JsonNode?> currentList = List; 109List<JsonNode?> otherList = array.List; 131internal int GetElementIndex(JsonNode? node) 137/// Returns an enumerable that wraps calls to <see cref="JsonNode.GetValue{T}"/>. 143foreach (JsonNode? item in List) 149private void InitializeFromArray(JsonNode?[] items) 151var list = new List<JsonNode?>(items); 161private void InitializeFromSpan(ReadOnlySpan<JsonNode?> items) 163List<JsonNode?> list = new(items.Length); 220JsonNode? nodeToAdd = ConvertFromValue(value, Options); 227private List<JsonNode?> List => _list ?? InitializeList(); 229private protected override JsonNode? GetItem(int index) 234private protected override void SetItem(int index, JsonNode? value) 241internal override unsafe void GetPath(ref ValueStringBuilder path, JsonNode? child) 268GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 278foreach (JsonNode? element in List) 294private List<JsonNode?> InitializeList() 296GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 305list = new List<JsonNode?>(jElement.GetArrayLength()); 309JsonNode? node = JsonNodeConverter.Create(element, Options); 332private void GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement) 376public JsonNode? Value;
System\Text\Json\Nodes\JsonArray.IList.cs (21)
17/// Adds a <see cref="JsonNode"/> to the end of the <see cref="JsonArray"/>. 20/// The <see cref="JsonNode"/> to be added to the end of the <see cref="JsonArray"/>. 22public void Add(JsonNode? item) 34List<JsonNode?>? list = _list; 58public bool Contains(JsonNode? item) => List.Contains(item); 63/// <param name="item">The <see cref="JsonNode"/> to locate in the <see cref="JsonArray"/>.</param> 67public int IndexOf(JsonNode? item) => List.IndexOf(item); 73/// <param name="item">The <see cref="JsonNode"/> to insert.</param> 77public void Insert(int index, JsonNode? item) 84/// Removes the first occurrence of a specific <see cref="JsonNode"/> from the <see cref="JsonArray"/>. 87/// The <see cref="JsonNode"/> to remove from the <see cref="JsonArray"/>. 92public bool Remove(JsonNode? item) 112JsonNode? item = List[index]; 125public int RemoveAll(Func<JsonNode?, bool> match) 166List<JsonNode?> list = List; 208void ICollection<JsonNode?>.CopyTo(JsonNode?[] array, int index) => List.CopyTo(array, index); 213/// <returns>A <see cref="IEnumerator{JsonNode}"/> for the <see cref="JsonNode"/>.</returns> 214public IEnumerator<JsonNode?> GetEnumerator() => List.GetEnumerator(); 227bool ICollection<JsonNode?>.IsReadOnly => false; 231private static void DetachParent(JsonNode? item)
System\Text\Json\Nodes\JsonNode.cs (30)
16/// declared as an <see cref="object"/> should be deserialized as a <see cref="JsonNode"/>. 22private JsonNode? _parent; 118/// Gets the parent <see cref="JsonNode"/>. 122public JsonNode? Parent 151internal abstract void GetPath(ref ValueStringBuilder path, JsonNode? child); 154/// Gets the root <see cref="JsonNode"/>. 159public JsonNode Root 163JsonNode? parent = Parent; 193/// The current <see cref="JsonNode"/> cannot be represented as a {T}. 196/// The current <see cref="JsonNode"/> is not a <see cref="JsonValue"/> or 210/// The current <see cref="JsonNode"/> is not a <see cref="JsonArray"/> or <see cref="JsonObject"/>. 212public JsonNode? this[int index] 218private protected virtual JsonNode? GetItem(int index) 224private protected virtual void SetItem(int index, JsonNode? node) => 236/// The current <see cref="JsonNode"/> is not a <see cref="JsonObject"/>. 238public JsonNode? this[string propertyName] 251/// Creates a new instance of the <see cref="JsonNode"/>. All children nodes are recursively cloned. 254public JsonNode DeepClone() => DeepCloneCore(); 256internal abstract JsonNode DeepCloneCore(); 304/// <param name="node1">The <see cref="JsonNode"/> to compare.</param> 305/// <param name="node2">The <see cref="JsonNode"/> to compare.</param> 307public static bool DeepEquals(JsonNode? node1, JsonNode? node2) 321internal abstract bool DeepEqualsCore(JsonNode node); 332JsonNode? node; 346internal void AssignParent(JsonNode parent) 353JsonNode? p = parent; 369/// to support arbitrary <see cref="JsonElement"/> and <see cref="JsonNode"/> values. 374internal static JsonNode? ConvertFromValue<T>(T? value, JsonNodeOptions? options = null) 381if (value is JsonNode node)
System\Text\Json\Nodes\JsonNode.Operators.cs (198)
11/// Defines an implicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 14/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 15public static implicit operator JsonNode(bool value) => JsonValue.Create(value); 18/// Defines an implicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 21/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 22public static implicit operator JsonNode?(bool? value) => JsonValue.Create(value); 25/// Defines an implicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 28/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 29public static implicit operator JsonNode(byte value) => JsonValue.Create(value); 32/// Defines an implicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 35/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 36public static implicit operator JsonNode?(byte? value) => JsonValue.Create(value); 39/// Defines an implicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 42/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 43public static implicit operator JsonNode(char value) => JsonValue.Create(value); 46/// Defines an implicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 49/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 50public static implicit operator JsonNode?(char? value) => JsonValue.Create(value); 53/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 56/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 57public static implicit operator JsonNode(DateTime value) => JsonValue.Create(value); 60/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 63/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 64public static implicit operator JsonNode?(DateTime? value) => JsonValue.Create(value); 67/// Defines an implicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 70/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 71public static implicit operator JsonNode(DateTimeOffset value) => JsonValue.Create(value); 74/// Defines an implicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 77/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 78public static implicit operator JsonNode?(DateTimeOffset? value) => JsonValue.Create(value); 81/// Defines an implicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 84/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 85public static implicit operator JsonNode(decimal value) => JsonValue.Create(value); 88/// Defines an implicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 91/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 92public static implicit operator JsonNode?(decimal? value) => JsonValue.Create(value); 95/// Defines an implicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 98/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 99public static implicit operator JsonNode(double value) => JsonValue.Create(value); 102/// Defines an implicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 105/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 106public static implicit operator JsonNode?(double? value) => JsonValue.Create(value); 109/// Defines an implicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 112/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 113public static implicit operator JsonNode(Guid value) => JsonValue.Create(value); 116/// Defines an implicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 119/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 120public static implicit operator JsonNode?(Guid? value) => JsonValue.Create(value); 123/// Defines an implicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 126/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 127public static implicit operator JsonNode(short value) => JsonValue.Create(value); 130/// Defines an implicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 133/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 134public static implicit operator JsonNode?(short? value) => JsonValue.Create(value); 137/// Defines an implicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 140/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 141public static implicit operator JsonNode(int value) => JsonValue.Create(value); 144/// Defines an implicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 147/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 148public static implicit operator JsonNode?(int? value) => JsonValue.Create(value); 151/// Defines an implicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 154/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 155public static implicit operator JsonNode(long value) => JsonValue.Create(value); 158/// Defines an implicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 161/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 162public static implicit operator JsonNode?(long? value) => JsonValue.Create(value); 165/// Defines an implicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 168/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 170public static implicit operator JsonNode(sbyte value) => JsonValue.Create(value); 173/// Defines an implicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 176/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 178public static implicit operator JsonNode?(sbyte? value) => JsonValue.Create(value); 181/// Defines an implicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 184/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 185public static implicit operator JsonNode(float value) => JsonValue.Create(value); 188/// Defines an implicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 191/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 192public static implicit operator JsonNode?(float? value) => JsonValue.Create(value); 195/// Defines an implicit conversion of a given <see cref="string"/> to a <see cref="JsonNode"/>. 198/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 200public static implicit operator JsonNode?(string? value) => JsonValue.Create(value); 203/// Defines an implicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 206/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 208public static implicit operator JsonNode(ushort value) => JsonValue.Create(value); 211/// Defines an implicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 214/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 216public static implicit operator JsonNode?(ushort? value) => JsonValue.Create(value); 219/// Defines an implicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 222/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 224public static implicit operator JsonNode(uint value) => JsonValue.Create(value); 227/// Defines an implicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 230/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 232public static implicit operator JsonNode?(uint? value) => JsonValue.Create(value); 235/// Defines an implicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 238/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 240public static implicit operator JsonNode(ulong value) => JsonValue.Create(value); 243/// Defines an implicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 246/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 248public static implicit operator JsonNode?(ulong? value) => JsonValue.Create(value); 251/// Defines an explicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 254/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 255public static explicit operator bool(JsonNode value) => value.GetValue<bool>(); 258/// Defines an explicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 261/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 262public static explicit operator bool?(JsonNode? value) => value?.GetValue<bool>(); 265/// Defines an explicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 268/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 269public static explicit operator byte(JsonNode value) => value.GetValue<byte>(); 272/// Defines an explicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 275/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 276public static explicit operator byte?(JsonNode? value) => value?.GetValue<byte>(); 279/// Defines an explicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 282/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 283public static explicit operator char(JsonNode value) => value.GetValue<char>(); 286/// Defines an explicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 289/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 290public static explicit operator char?(JsonNode? value) => value?.GetValue<char>(); 293/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 296/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 297public static explicit operator DateTime(JsonNode value) => value.GetValue<DateTime>(); 300/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 303/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 304public static explicit operator DateTime?(JsonNode? value) => value?.GetValue<DateTime>(); 307/// Defines an explicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 310/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 311public static explicit operator DateTimeOffset(JsonNode value) => value.GetValue<DateTimeOffset>(); 314/// Defines an explicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 317/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 318public static explicit operator DateTimeOffset?(JsonNode? value) => value?.GetValue<DateTimeOffset>(); 321/// Defines an explicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 324/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 325public static explicit operator decimal(JsonNode value) => value.GetValue<decimal>(); 328/// Defines an explicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 331/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 332public static explicit operator decimal?(JsonNode? value) => value?.GetValue<decimal>(); 335/// Defines an explicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 338/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 339public static explicit operator double(JsonNode value) => value.GetValue<double>(); 342/// Defines an explicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 345/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 346public static explicit operator double?(JsonNode? value) => value?.GetValue<double>(); 349/// Defines an explicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 352/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 353public static explicit operator Guid(JsonNode value) => value.GetValue<Guid>(); 356/// Defines an explicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 359/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 360public static explicit operator Guid?(JsonNode? value) => value?.GetValue<Guid>(); 363/// Defines an explicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 366/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 367public static explicit operator short(JsonNode value) => value.GetValue<short>(); 370/// Defines an explicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 373/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 374public static explicit operator short?(JsonNode? value) => value?.GetValue<short>(); 377/// Defines an explicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 380/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 381public static explicit operator int(JsonNode value) => value.GetValue<int>(); 384/// Defines an explicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 387/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 388public static explicit operator int?(JsonNode? value) => value?.GetValue<int>(); 391/// Defines an explicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 394/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 395public static explicit operator long(JsonNode value) => value.GetValue<long>(); 398/// Defines an explicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 401/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 402public static explicit operator long?(JsonNode? value) => value?.GetValue<long>(); 405/// Defines an explicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 408/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 410public static explicit operator sbyte(JsonNode value) => value.GetValue<sbyte>(); 413/// Defines an explicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 416/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 418public static explicit operator sbyte?(JsonNode? value) => value?.GetValue<sbyte>(); 421/// Defines an explicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 424/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 425public static explicit operator float(JsonNode value) => value.GetValue<float>(); 428/// Defines an explicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 431/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 432public static explicit operator float?(JsonNode? value) => value?.GetValue<float>(); 435/// Defines an explicit conversion of a given <see cref="string"/> to a <see cref="JsonNode"/>. 438/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 439public static explicit operator string?(JsonNode? value) => value?.GetValue<string>(); 442/// Defines an explicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 445/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 447public static explicit operator ushort(JsonNode value) => value.GetValue<ushort>(); 450/// Defines an explicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 453/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 455public static explicit operator ushort?(JsonNode? value) => value?.GetValue<ushort>(); 458/// Defines an explicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 461/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 463public static explicit operator uint(JsonNode value) => value.GetValue<uint>(); 466/// Defines an explicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 469/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 471public static explicit operator uint?(JsonNode? value) => value?.GetValue<uint>(); 474/// Defines an explicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 477/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 479public static explicit operator ulong(JsonNode value) => value.GetValue<ulong>(); 482/// Defines an explicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 485/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 487public static explicit operator ulong?(JsonNode? value) => value?.GetValue<ulong>();
System\Text\Json\Nodes\JsonNode.Parse.cs (12)
20/// The <see cref="JsonNode"/> from the reader. 47public static JsonNode? Parse( 62/// A <see cref="JsonNode"/> representation of the JSON value. 70public static JsonNode? Parse( 88/// A <see cref="JsonNode"/> representation of the JSON value. 93public static JsonNode? Parse( 104/// <see cref="JsonNode"/>. The Stream will be read to completion. 110/// A <see cref="JsonNode"/> representation of the JSON value. 115public static JsonNode? Parse( 128/// <see cref="JsonNode"/>. The Stream will be read to completion. 135/// A <see cref="Task"/> to produce a <see cref="JsonNode"/> representation of the JSON value. 140public static async Task<JsonNode?> ParseAsync(
System\Text\Json\Nodes\JsonNode.To.cs (1)
70/// Write the <see cref="JsonNode"/> into the provided <see cref="Utf8JsonWriter"/> as JSON.
System\Text\Json\Nodes\JsonNodeOptions.cs (1)
7/// Options to control <see cref="JsonNode"/> behavior.
System\Text\Json\Nodes\JsonObject.cs (34)
36public JsonObject(IEnumerable<KeyValuePair<string, JsonNode?>> properties, JsonNodeOptions? options = null) : this(options) 38int capacity = properties is ICollection<KeyValuePair<string, JsonNode?>> propertiesCollection ? propertiesCollection.Count : 0; 39OrderedDictionary<string, JsonNode?> dictionary = CreateDictionary(options, capacity); 41foreach (KeyValuePair<string, JsonNode?> node in properties) 78private OrderedDictionary<string, JsonNode?> Dictionary => _dictionary ?? InitializeDictionary(); 80private protected override JsonNode? GetItem(int index) => GetAt(index).Value; 81private protected override void SetItem(int index, JsonNode? value) => SetAt(index, value); 83internal override JsonNode DeepCloneCore() 85GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 99foreach (KeyValuePair<string, JsonNode?> item in dictionary) 107internal string GetPropertyName(JsonNode? node) 109KeyValuePair<string, JsonNode?>? item = FindValue(node); 124public bool TryGetPropertyValue(string propertyName, out JsonNode? jsonNode) => TryGetPropertyValue(propertyName, out jsonNode, out _); 141public bool TryGetPropertyValue(string propertyName, out JsonNode? jsonNode, out int index) 153GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 175GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 187foreach (KeyValuePair<string, JsonNode?> entry in Dictionary) 205internal override bool DeepEqualsCore(JsonNode node) 215OrderedDictionary<string, JsonNode?> currentDict = Dictionary; 216OrderedDictionary<string, JsonNode?> otherDict = jsonObject.Dictionary; 223foreach (KeyValuePair<string, JsonNode?> item in currentDict) 225if (!otherDict.TryGetValue(item.Key, out JsonNode? jsonNode) || !DeepEquals(item.Value, jsonNode)) 238internal JsonNode? GetItem(string propertyName) 242if (TryGetPropertyValue(propertyName, out JsonNode? value)) 251internal override void GetPath(ref ValueStringBuilder path, JsonNode? child) 272internal void SetItem(string propertyName, JsonNode? value) 276OrderedDictionary<string, JsonNode?> dict = Dictionary; 281JsonNode? replacedValue = dict.GetAt(index).Value; 295private void DetachParent(JsonNode? item) 302private KeyValuePair<string, JsonNode?>? FindValue(JsonNode? value) 304foreach (KeyValuePair<string, JsonNode?> item in Dictionary) 337foreach (KeyValuePair<string, JsonNode?> item in _node) 352public JsonNode? Value;
System\Text\Json\Nodes\JsonObject.IDictionary.cs (31)
13private OrderedDictionary<string, JsonNode?>? _dictionary; 26public void Add(string propertyName, JsonNode? value) 43public bool TryAdd(string propertyName, JsonNode? value) => TryAdd(propertyName, value, out _); 55public bool TryAdd(string propertyName, JsonNode? value, out int index) 81public void Add(KeyValuePair<string, JsonNode?> property) => Add(property.Key, property.Value); 88OrderedDictionary<string, JsonNode?>? dictionary = _dictionary; 96foreach (JsonNode? node in dictionary.Values) 140bool success = Dictionary.Remove(propertyName, out JsonNode? removedNode); 150/// Determines whether the <see cref="JsonObject"/> contains a specific property name and <see cref="JsonNode"/> reference. 156bool ICollection<KeyValuePair<string, JsonNode?>>.Contains(KeyValuePair<string, JsonNode?> item) => 157((IDictionary<string, JsonNode?>)Dictionary).Contains(item); 176void ICollection<KeyValuePair<string, JsonNode?>>.CopyTo(KeyValuePair<string, JsonNode?>[] array, int index) => 177((IDictionary<string, JsonNode?>)Dictionary).CopyTo(array, index); 185public IEnumerator<KeyValuePair<string, JsonNode?>> GetEnumerator() => Dictionary.GetEnumerator(); 196bool ICollection<KeyValuePair<string, JsonNode?>>.Remove(KeyValuePair<string, JsonNode?> item) => Remove(item.Key); 201ICollection<string> IDictionary<string, JsonNode?>.Keys => Dictionary.Keys; 206ICollection<JsonNode?> IDictionary<string, JsonNode?>.Values => Dictionary.Values; 222bool IDictionary<string, JsonNode?>.TryGetValue(string propertyName, out JsonNode? jsonNode) 232bool ICollection<KeyValuePair<string, JsonNode?>>.IsReadOnly => false; 242private OrderedDictionary<string, JsonNode?> InitializeDictionary() 244GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 248OrderedDictionary<string, JsonNode?> newDictionary = CreateDictionary(Options); 254JsonNode? node = JsonNodeConverter.Create(jElementProperty.Value, Options); 262OrderedDictionary<string, JsonNode?>? exchangedDictionary = Interlocked.CompareExchange(ref _dictionary, newDictionary, null); 280private static OrderedDictionary<string, JsonNode?> CreateDictionary(JsonNodeOptions? options, int capacity = 0) 293private void GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement)
System\Text\Json\Nodes\JsonObject.IList.cs (17)
15public KeyValuePair<string, JsonNode?> GetAt(int index) => Dictionary.GetAt(index); 24public void SetAt(int index, string propertyName, JsonNode? value) 28OrderedDictionary<string, JsonNode?> dictionary = Dictionary; 29KeyValuePair<string, JsonNode?> existing = dictionary.GetAt(index); 40public void SetAt(int index, JsonNode? value) 42OrderedDictionary<string, JsonNode?> dictionary = Dictionary; 43KeyValuePair<string, JsonNode?> existing = dictionary.GetAt(index); 67public void Insert(int index, string propertyName, JsonNode? value) 80KeyValuePair<string, JsonNode?> existing = Dictionary.GetAt(index); 86KeyValuePair<string, JsonNode?> IList<KeyValuePair<string, JsonNode?>>.this[int index] 93int IList<KeyValuePair<string, JsonNode?>>.IndexOf(KeyValuePair<string, JsonNode?> item) => ((IList<KeyValuePair<string, JsonNode?>>)Dictionary).IndexOf(item); 96void IList<KeyValuePair<string, JsonNode?>>.Insert(int index, KeyValuePair<string, JsonNode?> item) => Insert(index, item.Key, item.Value); 99void IList<KeyValuePair<string, JsonNode?>>.RemoveAt(int index) => RemoveAt(index);
System\Text\Json\Nodes\JsonValue.cs (6)
32/// <seealso cref="JsonNode.GetValue{T}"></seealso> 57if (value is JsonNode) 91if (value is JsonNode) 106internal override bool DeepEqualsCore(JsonNode otherNode) 126static JsonElement ToJsonElement(JsonNode node, out JsonDocument? backingDocument) 154internal sealed override void GetPath(ref ValueStringBuilder path, JsonNode? child)
System\Text\Json\Nodes\JsonValueOfElement.cs (2)
20internal override JsonNode DeepCloneCore() => new JsonValueOfElement(Value.Clone(), Options); 23internal override bool DeepEqualsCore(JsonNode otherNode)
System\Text\Json\Nodes\JsonValueOfJsonPrimitive.cs (3)
46internal override JsonNode DeepCloneCore() => new JsonValueOfJsonString(_value, Options); 137internal override JsonNode DeepCloneCore() => new JsonValueOfJsonBool(_value, Options); 184internal override JsonNode DeepCloneCore() => new JsonValueOfJsonNumber(_value, Options);
System\Text\Json\Nodes\JsonValueOfT.cs (1)
19Debug.Assert(value is not JsonNode);
System\Text\Json\Nodes\JsonValueOfTCustomized.cs (1)
27internal override JsonNode DeepCloneCore() => JsonSerializer.SerializeToNode(Value, _jsonTypeInfo)!;
System\Text\Json\Nodes\JsonValueOfTPrimitive.cs (2)
28internal override JsonNode DeepCloneCore() => new JsonValuePrimitive<TValue>(Value, _converter, Options); 30internal override bool DeepEqualsCore(JsonNode otherNode)
System\Text\Json\Schema\JsonSchema.cs (13)
59public JsonNode? Constant { get; set { VerifyMutable(); field = value; } } 77public JsonNode? DefaultValue { get; set { VerifyMutable(); field = value; } } 142public JsonNode ToJsonNode(JsonSchemaExporterOptions options) 146return CompleteSchema((JsonNode)boolSchema); 161if (MapSchemaType(Type) is JsonNode type) 197requiredArray.Add((JsonNode)requiredProperty); 241objSchema.Add(MinLengthPropertyName, (JsonNode)minLength); 246objSchema.Add(MaxLengthPropertyName, (JsonNode)maxLength); 251objSchema.Add(DeprecatedPropertyName, (JsonNode)deprecated); 261JsonNode CompleteSchema(JsonNode schema) 313public static JsonNode? MapSchemaType(JsonSchemaType schemaType) 330array.Add((JsonNode)ToIdentifier(type)!);
System\Text\Json\Schema\JsonSchemaExporter.cs (7)
22/// Gets the JSON schema for <paramref name="type"/> as a <see cref="JsonNode"/> document. 28public static JsonNode GetJsonSchemaAsNode(this JsonSerializerOptions options, Type type, JsonSchemaExporterOptions? exporterOptions = null) 39/// Gets the JSON schema for <paramref name="typeInfo"/> as a <see cref="JsonNode"/> document. 44public static JsonNode GetJsonSchemaAsNode(this JsonTypeInfo typeInfo, JsonSchemaExporterOptions? exporterOptions = null) 115JsonNode discriminatorNode = discriminatorValue switch 117string stringId => (JsonNode)stringId, 118_ => (JsonNode)(int)discriminatorValue,
System\Text\Json\Schema\JsonSchemaExporterOptions.cs (2)
31public Func<JsonSchemaExporterContext, JsonNode, JsonNode>? TransformSchemaNode { get; init; }
System\Text\Json\Serialization\Attributes\JsonExtensionDataAttribute.cs (1)
18/// <see cref="object"/>, the type of object created will either be a <see cref="System.Text.Json.Nodes.JsonNode"/> or a
System\Text\Json\Serialization\Converters\Node\JsonArrayConverter.cs (1)
57JsonNode? item = JsonNodeConverter.ReadAsJsonNode(ref reader, options);
System\Text\Json\Serialization\Converters\Node\JsonNodeConverter.cs (7)
14internal sealed class JsonNodeConverter : JsonConverter<JsonNode?> 18public override void Write(Utf8JsonWriter writer, JsonNode? value, JsonSerializerOptions options) 30public override JsonNode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 37internal static JsonNode? ReadAsJsonElement(ref Utf8JsonReader reader, JsonNodeOptions options) 58internal static JsonNode? ReadAsJsonNode(ref Utf8JsonReader reader, JsonNodeOptions options) 79public static JsonNode? Create(JsonElement element, JsonNodeOptions? options) 81JsonNode? node;
System\Text\Json\Serialization\Converters\Node\JsonNodeConverterFactory.cs (2)
33Debug.Assert(typeof(JsonNode) == typeToConvert); 37public override bool CanConvert(Type typeToConvert) => typeof(JsonNode).IsAssignableFrom(typeToConvert);
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (5)
25bool success = JsonNodeConverter.Instance.TryRead(ref reader, typeof(JsonNode), options, ref state, out JsonNode? value, out _); 31Debug.Assert(value is null || value is JsonNode); 32JsonNode? jNodeValue = value; 104JsonNode? value = JsonNodeConverter.ReadAsJsonNode(ref reader, options);
System\Text\Json\Serialization\Converters\Object\ObjectConverter.cs (1)
132JsonNode? node = JsonNodeConverter.Instance.Read(ref reader, typeToConvert, options);
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (1)
505enumValues.Add((JsonNode)fieldInfo.JsonName);
System\Text\Json\Serialization\Converters\Value\JsonPrimitiveConverter.cs (3)
64new JsonSchema { Enum = [(JsonNode)"NaN", (JsonNode)"Infinity", (JsonNode)"-Infinity"] },
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (3)
462JsonNode? jsonNode, 471foreach (KeyValuePair<string, JsonNode?> property in jsonObject) 509static string ReadAsStringMetadataValue(JsonNode? jsonNode)
System\Text\Json\Serialization\JsonSerializer.Read.Node.cs (17)
15/// Converts the <see cref="JsonNode"/> representing a single JSON value into a <typeparamref name="TValue"/>. 19/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 30public static TValue? Deserialize<TValue>(this JsonNode? node, JsonSerializerOptions? options = null) 37/// Converts the <see cref="JsonNode"/> representing a single JSON value into a <paramref name="returnType"/>. 40/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 52public static object? Deserialize(this JsonNode? node, Type returnType, JsonSerializerOptions? options = null) 61/// Converts the <see cref="JsonNode"/> representing a single JSON value into a <typeparamref name="TValue"/>. 65/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 73public static TValue? Deserialize<TValue>(this JsonNode? node, JsonTypeInfo<TValue> jsonTypeInfo) 82/// Converts the <see cref="JsonNode"/> representing a single JSON value into an instance specified by the <paramref name="jsonTypeInfo"/>. 85/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 90public static object? Deserialize(this JsonNode? node, JsonTypeInfo jsonTypeInfo) 99/// Converts the <see cref="JsonNode"/> representing a single JSON value into a <paramref name="returnType"/>. 102/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 130public static object? Deserialize(this JsonNode? node, Type returnType, JsonSerializerContext context) 139private static TValue? ReadFromNode<TValue>(JsonNode? node, JsonTypeInfo<TValue> jsonTypeInfo) 160private static object? ReadFromNodeAsObject(JsonNode? node, JsonTypeInfo jsonTypeInfo)
System\Text\Json\Serialization\JsonSerializer.Write.Node.cs (19)
15/// Converts the provided value into a <see cref="JsonNode"/>. 18/// <returns>A <see cref="JsonNode"/> representation of the JSON value.</returns> 27public static JsonNode? SerializeToNode<TValue>(TValue value, JsonSerializerOptions? options = null) 34/// Converts the provided value into a <see cref="JsonNode"/>. 36/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 52public static JsonNode? SerializeToNode(object? value, Type inputType, JsonSerializerOptions? options = null) 60/// Converts the provided value into a <see cref="JsonNode"/>. 63/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 69public static JsonNode? SerializeToNode<TValue>(TValue value, JsonTypeInfo<TValue> jsonTypeInfo) 78/// Converts the provided value into a <see cref="JsonNode"/>. 80/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 89public static JsonNode? SerializeToNode(object? value, JsonTypeInfo jsonTypeInfo) 98/// Converts the provided value into a <see cref="JsonNode"/>. 100/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 115public static JsonNode? SerializeToNode(object? value, Type inputType, JsonSerializerContext context) 124private static JsonNode? WriteNode<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo) 134return JsonNode.Parse(output.WrittenSpan, options.GetNodeOptions(), options.GetDocumentOptions()); 142private static JsonNode? WriteNodeAsObject(object? value, JsonTypeInfo jsonTypeInfo) 152return JsonNode.Parse(output.WrittenSpan, options.GetNodeOptions(), options.GetDocumentOptions());
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (2)
129/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonNode"/> values. 132public static JsonConverter<JsonNode?> JsonNodeConverter => field ??= new JsonNodeConverter();