7 types derived from JsonNode
System.Text.Json (7)
System\Text\Json\Nodes\JsonArray.cs (1)
21
public sealed partial class JsonArray :
JsonNode
System\Text\Json\Nodes\JsonArray.IList.cs (2)
9
public sealed partial class JsonArray :
JsonNode
, IList<
JsonNode
?>
System\Text\Json\Nodes\JsonObject.cs (1)
19
public sealed partial class JsonObject :
JsonNode
System\Text\Json\Nodes\JsonObject.IDictionary.cs (1)
11
public partial class JsonObject : IDictionary<string,
JsonNode
?>
System\Text\Json\Nodes\JsonObject.IList.cs (1)
9
public partial class JsonObject : IList<KeyValuePair<string,
JsonNode
?>>
System\Text\Json\Nodes\JsonValue.cs (1)
14
public abstract partial class JsonValue :
JsonNode
1498 references to JsonNode
aspire (49)
Agents\ClaudeCode\ClaudeCodeAgentEnvironmentScanner.cs (2)
177
var config =
JsonNode
.Parse(content)?.AsObject();
184
if (config.TryGetPropertyValue("mcpServers", out
var
serversNode) && serversNode is JsonObject servers)
Agents\CopilotCli\CopilotCliAgentEnvironmentScanner.cs (2)
160
var config =
JsonNode
.Parse(content)?.AsObject();
167
if (config.TryGetPropertyValue("mcpServers", out
var
serversNode) && serversNode is JsonObject servers)
Agents\DeprecatedMcpCommandScanner.cs (11)
65
var config =
JsonNode
.Parse(content)?.AsObject();
120
if (!config.TryGetPropertyValue(serversKey, out
var
serversNode) || serversNode is not JsonObject servers)
125
if (!servers.TryGetPropertyValue("aspire", out
var
aspireNode) || aspireNode is not JsonObject aspire)
130
if (!aspire.TryGetPropertyValue("args", out
var
argsNode) || argsNode is not JsonArray args)
152
if (!config.TryGetPropertyValue(serversKey, out
var
mcpNode) || mcpNode is not JsonObject mcp)
157
if (!mcp.TryGetPropertyValue("aspire", out
var
aspireNode) || aspireNode is not JsonObject aspire)
162
if (!aspire.TryGetPropertyValue("command", out
var
commandNode) || commandNode is not JsonArray command)
222
if (config.TryGetPropertyValue(serversKey, out
var
serversNode) &&
224
servers.TryGetPropertyValue("aspire", out
var
aspireNode) &&
236
if (config.TryGetPropertyValue(serversKey, out
var
mcpNode) &&
238
mcp.TryGetPropertyValue("aspire", out
var
aspireNode) &&
Agents\McpConfigFileHelper.cs (3)
40
var config =
JsonNode
.Parse(content)?.AsObject();
47
if (config.TryGetPropertyValue(serverContainerKey, out
var
serversNode) && serversNode is JsonObject servers)
84
return
JsonNode
.Parse(content)?.AsObject() ?? new JsonObject();
Agents\OpenCode\OpenCodeAgentEnvironmentScanner.cs (2)
125
var config =
JsonNode
.Parse(content)?.AsObject();
132
if (config.TryGetPropertyValue("mcp", out
var
mcpNode) && mcpNode is JsonObject mcp)
Agents\VsCode\VsCodeAgentEnvironmentScanner.cs (2)
211
var config =
JsonNode
.Parse(content)?.AsObject();
218
if (config.TryGetPropertyValue("servers", out
var
serversNode) && serversNode is JsonObject servers)
Configuration\ConfigurationService.cs (3)
26
:
JsonNode
.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject() ?? new JsonObject();
58
var settings =
JsonNode
.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject();
165
var settings =
JsonNode
.Parse(content, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject();
Npm\SigstoreNpmProvenanceChecker.cs (6)
124
JsonNode
? doc;
127
doc =
JsonNode
.Parse(attestationJson);
135
var
attestationsNode = doc?["attestations"];
141
foreach (
var
attestation in attestations)
148
var
predicateTypeNode = attestationObj["predicateType"];
169
var
bundleNode = attestationObj["bundle"];
Projects\FallbackProjectParser.cs (2)
133
packageRefArray.Add((
JsonNode
?)packageObj);
144
projectRefArray.Add((
JsonNode
?)projectObj);
src\Shared\ConsoleLogs\SharedAIHelpers.cs (3)
45
public static int EstimateSerializedJsonTokenSize(
JsonNode
node)
212
var spanObjects = new List<
JsonNode
>();
231
var linkObjects = span.Links.Select(link => (
JsonNode
)new JsonObject
src\Shared\Json\JsonFlattener.cs (1)
38
if (!current.TryGetPropertyValue(key, out
var
existing) || existing is not JsonObject)
src\Shared\UserSecrets\SecretsStore.cs (1)
135
var parsed =
JsonNode
.Parse(json)?.AsObject();
Utils\ConfigurationHelper.cs (3)
116
var
node =
JsonNode
.Parse(content, documentOptions: ParseOptions);
149
var settings =
JsonNode
.Parse(content, documentOptions: ParseOptions)?.AsObject();
Utils\EnvironmentChecker\DeprecatedAgentConfigCheck.cs (7)
54
var config =
JsonNode
.Parse(content)?.AsObject();
105
if (!config.TryGetPropertyValue(serversKey, out
var
serversNode) || serversNode is not JsonObject servers)
110
if (!servers.TryGetPropertyValue("aspire", out
var
aspireNode) || aspireNode is not JsonObject aspire)
115
if (!aspire.TryGetPropertyValue("args", out
var
argsNode) || argsNode is not JsonArray args)
137
if (!config.TryGetPropertyValue(serversKey, out
var
mcpNode) || mcpNode is not JsonObject mcp)
142
if (!mcp.TryGetPropertyValue("aspire", out
var
aspireNode) || aspireNode is not JsonObject aspire)
147
if (!aspire.TryGetPropertyValue("command", out
var
commandNode) || commandNode is not JsonArray command)
Utils\EnvironmentChecker\DevCertsCheck.cs (1)
216
certificatesArray.Add((
JsonNode
)certNode);
Aspire.Cli.EndToEnd.Tests (1)
ProjectReferenceTests.cs (1)
119
var config =
JsonNode
.Parse(configJson)?.AsObject()
Aspire.Cli.Tests (18)
Agents\CopilotCliAgentEnvironmentScannerTests.cs (2)
61
var config =
JsonNode
.Parse(content)?.AsObject();
122
var config =
JsonNode
.Parse(content)?.AsObject();
Agents\VsCodeAgentEnvironmentScannerTests.cs (3)
147
var config =
JsonNode
.Parse(content)?.AsObject();
200
var config =
JsonNode
.Parse(content)?.AsObject();
246
var config =
JsonNode
.Parse(content)?.AsObject();
Commands\ConfigCommandTests.cs (11)
75
var settings =
JsonNode
.Parse(json)?.AsObject();
98
var settings =
JsonNode
.Parse(json)?.AsObject();
123
var settings =
JsonNode
.Parse(json)?.AsObject();
155
var settings =
JsonNode
.Parse(json)?.AsObject();
275
var settings =
JsonNode
.Parse(json)?.AsObject();
491
var settings =
JsonNode
.Parse(json)?.AsObject();
523
var settings =
JsonNode
.Parse(json)?.AsObject();
554
var settings =
JsonNode
.Parse(json)?.AsObject();
585
var settings =
JsonNode
.Parse(json)?.AsObject();
615
var settings =
JsonNode
.Parse(json)?.AsObject();
648
var settings =
JsonNode
.Parse(json)?.AsObject();
Mcp\ListStructuredLogsToolTests.cs (1)
191
var logsArray =
JsonNode
.Parse(jsonText)?.AsArray();
Mcp\ListTracesToolTests.cs (1)
163
var tracesArray =
JsonNode
.Parse(jsonText)?.AsArray();
Aspire.Components.Common.TestUtilities (4)
ConformanceTests.cs (4)
392
var
config =
JsonNode
.Parse(ValidJsonConfig);
406
var
config =
JsonNode
.Parse(json);
Aspire.Dashboard (25)
Model\GenAI\GenAIEvents.cs (2)
25
public
JsonNode
? Content { get; set; }
45
public
JsonNode
? Arguments { get; set; }
Model\GenAI\GenAIItemPartViewModel.cs (1)
144
jsonObject[kvp.Key] =
JsonNode
.Parse(kvp.Value.GetRawText());
Model\GenAI\GenAIMessageParsingHelper.cs (4)
145
internal static
JsonNode
? TryParseStringJsonNode(
JsonNode
? node)
151
var
parsed =
JsonNode
.Parse(json);
Model\GenAI\GenAIMessages.cs (4)
56
public
JsonNode
? Arguments { get; set; }
70
public
JsonNode
? Response { get; set; } = default!;
143
public
JsonNode
? ServerToolCall { get; set; }
157
public
JsonNode
? ServerToolCallResponse { get; set; }
Model\GenAI\GenAISchemaHelpers.cs (5)
54
foreach (
var
item in requiredArray)
66
schema.Enum = new List<
JsonNode
>();
67
foreach (
var
item in enumArray)
79
internal static JsonSchemaType? ParseTypeValue(
JsonNode
? typeNode)
94
foreach (
var
item in typeArray)
Model\GenAI\GenAIVisualizerDialogViewModel.cs (5)
89
var
jsonNode =
JsonNode
.Parse(toolDefinitionsJson, documentOptions: documentOptions);
93
foreach (
var
item in array)
518
var
toolResponse = GenAIMessageParsingHelper.TryParseStringJsonNode(toolEvent.Content);
555
var
args = GenAIMessageParsingHelper.TryParseStringJsonNode(function.Arguments);
Otlp\Model\OtlpHelpers.cs (1)
117
private static
JsonNode
? ConvertAnyValue(AnyValue value)
src\Shared\ConsoleLogs\SharedAIHelpers.cs (3)
45
public static int EstimateSerializedJsonTokenSize(
JsonNode
node)
212
var spanObjects = new List<
JsonNode
>();
231
var linkObjects = span.Links.Select(link => (
JsonNode
)new JsonObject
Aspire.Dashboard.Components.Tests (2)
Controls\GenAIVisualizerDialogTests.cs (2)
76
Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments =
JsonNode
.Parse(@"{""count"":2}") }]
81
Parts = [new ToolCallResponsePart { Response =
JsonNode
.Parse(@"[""Jack"",""Jane""]") }]
Aspire.Dashboard.Tests (42)
Integration\McpConfigurationTests.cs (14)
47
var
parsed =
JsonNode
.Parse(json);
58
var
input = inputsArray![0];
65
var
servers = parsed["servers"];
68
var
dashboard = servers!["aspire-dashboard"];
74
var
headers = dashboard["headers"];
109
var
parsed =
JsonNode
.Parse(json);
123
var
input = inputsArray![0];
130
var
headers = parsed["headers"];
156
var
parsed =
JsonNode
.Parse(json);
165
var
servers = parsed["servers"];
168
var
dashboard = servers!["aspire-dashboard"];
Integration\McpServiceTests.cs (10)
45
var
jsonResponse =
JsonNode
.Parse(responseData!)!;
122
var
jsonResponse =
JsonNode
.Parse(responseData!)!;
147
var
jsonResponse =
JsonNode
.Parse(responseData!)!;
184
var
jsonResponse =
JsonNode
.Parse(responseData!)!;
245
var
jsonResponse =
JsonNode
.Parse(responseData!)!;
Integration\StartupTests.cs (2)
427
var
jsonResponse =
JsonNode
.Parse(responseData!)!;
Model\GenAIItemPartViewModelTests.cs (4)
64
Response =
JsonNode
.Parse("""["Jack","Jane"]""")
96
Response =
JsonNode
.Parse("""{"name":"Jack","age":30}""")
121
Arguments =
JsonNode
.Parse("""{"location":"東京","unit":"celsius"}""")
138
Response =
JsonNode
.Parse("""{"weather":"晴れ","city":"東京"}""")
Model\GenAISchemaHelpersTests.cs (8)
114
var
typeAsObject =
JsonNode
.Parse("""{"description": "This is an object instead of a string"}""");
123
var typeArrayWithObjects =
JsonNode
.Parse("""["string", {"invalid": "object"}, "number"]""") as JsonArray;
137
var typeArrayWithOnlyObjects =
JsonNode
.Parse("""[{"invalid": "object"}, {"another": "object"}]""") as JsonArray;
152
var
typeString =
JsonNode
.Parse("\"string\"");
160
var typeArray =
JsonNode
.Parse("""["string", "null"]""") as JsonArray;
186
var schemaObj =
JsonNode
.Parse(schemaJson) as JsonObject;
Model\GenAIVisualizerDialogViewModelTests.cs (4)
503
Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments =
JsonNode
.Parse(@"{""count"":2}") }]
508
Parts = [new ToolCallResponsePart { Response =
JsonNode
.Parse(@"[""Jack"",""Jane""]") }]
626
Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments =
JsonNode
.Parse(@"{""count"":2}") }]
631
Parts = [new ToolCallResponsePart { Response =
JsonNode
.Parse(@"[""Jack"",""Jane""]") }]
Aspire.Hosting (16)
Ats\UserSecretsExports.cs (1)
43
var state =
JsonNode
.Parse(json) as JsonObject
Dashboard\DashboardEventHandlers.cs (4)
148
var configJson =
JsonNode
.Parse(configText)?.AsObject();
161
foreach (
var
framework in frameworks)
240
var configJson =
JsonNode
.Parse(originalConfigText)?.AsObject();
254
foreach (
var
framework in frameworks)
Dcp\DcpExecutor.cs (2)
2550
var
current = JsonSerializer.SerializeToNode(obj);
2555
var
changed = JsonSerializer.SerializeToNode(copy);
Devcontainers\DevcontainerSettingsWriter.cs (2)
123
if (!settings.TryGetPropertyValue(PortAttributesFieldName, out
var
portsAttributesNode))
167
if (!portsAttributes.TryGetPropertyValue(port, out
var
portAttributeNode))
Pipelines\Internal\DeploymentStateManagerBase.cs (6)
91
var flattenedState =
JsonNode
.Parse(fileContent, documentOptions: jsonDocumentOptions)!.AsObject();
149
var
sectionData = TryGetNestedPropertyValue(_state, sectionName);
180
private static
JsonNode
? TryGetNestedPropertyValue(JsonObject? node, string path)
188
JsonNode
? current = node;
192
if (current is not JsonObject currentObj || !currentObj.TryGetPropertyValue(segment, out
var
nextNode))
288
if (!current.TryGetPropertyValue(segment, out
var
nextNode) || nextNode is not JsonObject nextObj)
Pipelines\Internal\JsonFlattener.cs (1)
44
if (!current.TryGetPropertyValue(key, out
var
existing) || existing is not JsonObject)
Aspire.Hosting.Azure (12)
AzureBicepResource.cs (3)
250
if (inputValue is
JsonNode
|| inputValue is IEnumerable<string>)
386
if (
JsonNode
.Parse(responseContent) is JsonObject responseObj)
429
foreach (
var
detail in detailsArray)
AzureBicepResourceExtensions.cs (1)
189
public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name,
JsonNode
value)
Provisioning\BicepUtilities.cs (3)
54
JsonNode
node => node,
115
var parameters =
JsonNode
.Parse(jsonString)?.AsObject();
117
?
JsonNode
.Parse(scopeString)?.AsObject()
Provisioning\JsonExtensions.cs (3)
10
internal static
JsonNode
Prop(this
JsonNode
obj, string key)
15
var
node = jsonObj[key];
Provisioning\Provisioners\BicepProvisioner.cs (2)
55
JsonNode
? outputObj = null;
58
outputObj =
JsonNode
.Parse(outputJson);
Aspire.Hosting.Azure.EventHubs (5)
AzureEventHubsExtensions.cs (3)
323
var
tempConfig =
JsonNode
.Parse(CreateEmulatorConfigJson(builder.Resource));
441
public static IResourceBuilder<AzureEventHubsEmulatorResource> WithConfiguration(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, Action<
JsonNode
> configJson)
ConfigJsonAnnotation.cs (2)
14
public ConfigJsonAnnotation(Action<
JsonNode
> configure)
19
public Action<
JsonNode
> Configure { get; }
Aspire.Hosting.Azure.ServiceBus (5)
AzureServiceBusExtensions.cs (3)
471
var
tempConfig =
JsonNode
.Parse(CreateEmulatorConfigJson(builder.Resource));
549
public static IResourceBuilder<AzureServiceBusEmulatorResource> WithConfiguration(this IResourceBuilder<AzureServiceBusEmulatorResource> builder, Action<
JsonNode
> configJson)
ConfigJsonAnnotation.cs (2)
14
public ConfigJsonAnnotation(Action<
JsonNode
> configure)
19
public Action<
JsonNode
> Configure { get; }
Aspire.Hosting.Azure.Tests (41)
AzureAppServiceTests.cs (1)
989
private static Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureBicepResourceTests.cs (1)
192
var
manifest = await ManifestUtils.GetManifest(bicepResource.Resource);
AzureContainerAppsTests.cs (1)
1645
private static Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureDeployerTests.cs (4)
1426
var
stateJson =
JsonNode
.Parse(stateContent);
1548
var
stateJson =
JsonNode
.Parse(stateContent);
AzureFunctionsTests.cs (1)
457
private static Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureInfrastructureExtensionsTests.cs (3)
27
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
52
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
91
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
AzureManifestUtils.cs (5)
17
public static Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource, bool skipPreparer = false) =>
20
public static Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource) =>
23
private static async Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource, bool skipPreparer)
33
var
manifestNode = await ManifestUtils.GetManifest(resource, manifestDir);
35
if (!manifestNode.AsObject().TryGetPropertyValue("path", out
var
pathNode))
AzurePostgresExtensionsTests.cs (1)
561
var
manifest = await ManifestUtils.GetManifest(postgres.Resource);
AzureStorageExtensionsTests.cs (12)
490
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
505
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
520
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
575
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
590
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
605
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
713
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
726
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
739
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
795
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
810
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
825
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
JsonExtensionsTests.cs (4)
15
var
azureNode = rootJson.Prop("Azure");
19
var
retrievedNode = rootJson.Prop("Azure");
33
var
newNode = rootJson.Prop("NewProperty");
47
var
deeply = rootJson.Prop("Level1")
ProvisioningContextTests.cs (2)
191
var
parsed =
JsonNode
.Parse(result);
ProvisioningTestHelpers.cs (1)
616
var sectionData = _state.TryGetPropertyValue(sectionName, out
var
node) && node is JsonObject obj
PublicApiTests\EventHubsPublicApiTests.cs (2)
359
Action<
JsonNode
> configJson = (_) => { };
372
Action<
JsonNode
> configJson = null!;
PublicApiTests\ServiceBusPublicApiTests.cs (2)
291
Action<
JsonNode
> configJson = (_) => { };
304
Action<
JsonNode
> configJson = null!;
RoleAssignmentTests.cs (1)
366
private static Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
Aspire.Hosting.Containers.Tests (10)
ContainerResourceTests.cs (5)
137
var
manifest = await ManifestUtils.GetManifest(c2.Resource);
176
var
manifest = await ManifestUtils.GetManifest(containerResource);
210
var
manifest = await ManifestUtils.GetManifest(containerResource);
257
var
manifest = await ManifestUtils.GetManifest(containerResource);
306
var
manifest = await ManifestUtils.GetManifest(containerResource, manifestDirectory: appHostPath);
WithDockerfileTests.cs (5)
272
var
manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath);
319
var
manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath);
365
var
manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath);
410
var
manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath);
852
var
manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath);
Aspire.Hosting.DotnetTool.Tests (1)
AddDotnetToolTests.cs (1)
357
var
manifest = await ManifestUtils.GetManifest(tool.Resource).DefaultTimeout();
Aspire.Hosting.Garnet.Tests (3)
AddGarnetTests.cs (3)
93
var
manifest = await ManifestUtils.GetManifest(garnet.Resource);
133
var
manifest = await ManifestUtils.GetManifest(garnet.Resource);
169
var
manifest = await ManifestUtils.GetManifest(garnet.Resource);
Aspire.Hosting.JavaScript.Tests (9)
AddNodeAppTests.cs (1)
32
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource);
AddViteAppTests.cs (8)
31
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
97
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
117
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
137
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
162
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
180
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
204
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
222
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
82
var
manifest = await ManifestUtils.GetManifest(kafka.Resource);
Aspire.Hosting.Keycloak.Tests (1)
KeycloakResourceBuilderTests.cs (1)
114
var
manifest = await ManifestUtils.GetManifest(keycloak.Resource);
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
136
var
serverManifest = await ManifestUtils.GetManifest(milvus.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
137
var
dbManifest = await ManifestUtils.GetManifest(db1.Resource);
Aspire.Hosting.MongoDB.Tests (3)
AddMongoDBTests.cs (2)
215
var
mongoManifest = await ManifestUtils.GetManifest(mongo.Resource);
216
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
ConnectionPropertiesTests.cs (1)
105
var
manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.MySql.Tests (4)
AddMySqlTests.cs (3)
160
var
mySqlManifest = await ManifestUtils.GetManifest(mysql.Resource);
161
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
199
var
serverManifest = await ManifestUtils.GetManifest(mysql.Resource);
ConnectionPropertiesTests.cs (1)
92
var
manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.Nats.Tests (3)
AddNatsTests.cs (2)
193
var
manifest = await ManifestUtils.GetManifest(nats.Resource);
230
var
manifest = await ManifestUtils.GetManifest(nats.Resource);
ConnectionPropertiesTests.cs (1)
66
var
manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.Oracle.Tests (4)
AddOracleTests.cs (3)
199
var
serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
200
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
238
var
serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
ConnectionPropertiesTests.cs (1)
88
var
oracleManifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.PostgreSQL.Tests (3)
AddPostgresTests.cs (3)
274
var
serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
275
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
318
var
serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
Aspire.Hosting.Python.Tests (2)
AddPythonAppTests.cs (2)
38
var
manifest = await ManifestUtils.GetManifest(pyproj.Resource, manifestDirectory: projectDirectory);
76
var
manifest = await ManifestUtils.GetManifest(pyproj.Resource, manifestDirectory: projectDirectory);
Aspire.Hosting.Qdrant.Tests (2)
AddQdrantTests.cs (2)
249
var
serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
287
var
serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
Aspire.Hosting.RabbitMQ.Tests (3)
AddRabbitMQTests.cs (2)
207
var
manifest = await ManifestUtils.GetManifest(rabbit.Resource);
252
var
manifest = await ManifestUtils.GetManifest(rabbit.Resource);
ConnectionPropertiesTests.cs (1)
66
var
manifest = await ManifestUtils.GetManifest(app.Resource);
Aspire.Hosting.Redis.Tests (17)
AddRedisTests.cs (14)
150
var
fullManifest = await ManifestUtils.GetManifestForModel(model);
151
var
resources = fullManifest["resources"]!;
152
var
manifest = resources["redis"]!;
175
var
fullManifest = await ManifestUtils.GetManifestForModel(model);
176
var
resources = fullManifest["resources"]!;
177
var
manifest = resources["redis"]!;
204
var
fullManifest = await ManifestUtils.GetManifestForModel(model);
205
var
resources = fullManifest["resources"]!;
206
var
manifest = resources["redis"]!;
230
var
fullManifest = await ManifestUtils.GetManifestForModel(model);
231
var
resources = fullManifest["resources"]!;
232
var
manifest = resources["redis"]!;
926
private static void AssertConditionalExpressionInManifest(
JsonNode
resources, string creName)
928
var
creEntry = resources[creName];
RedisFunctionalTests.cs (3)
572
var
jo =
JsonNode
.Parse(content);
574
var
agreements = jo["agreements"];
Aspire.Hosting.RemoteHost (66)
Ats\AtsCallbackProxyFactory.cs (14)
134
var addMethod = jsonObjectType.GetMethod("Add", [typeof(string), typeof(
JsonNode
)]);
172
private
JsonNode
? MarshalArg(object? value)
240
_invoker.InvokeAsync<
JsonNode
?>(callbackId, args, cancellationToken).GetAwaiter().GetResult();
246
var
result = _invoker.InvokeAsync<
JsonNode
?>(callbackId, args, cancellationToken).GetAwaiter().GetResult();
253
var
result = _invoker.InvokeAsync<
JsonNode
?>(callbackId, args, cancellationToken).GetAwaiter().GetResult();
260
await _invoker.InvokeAsync<
JsonNode
?>(callbackId, args, cancellationToken).ConfigureAwait(false);
266
var
result = await _invoker.InvokeAsync<
JsonNode
?>(callbackId, args, cancellationToken).ConfigureAwait(false);
273
var
result = await _invoker.InvokeAsync<
JsonNode
?>(callbackId, args, cancellationToken).ConfigureAwait(false);
277
private T? UnmarshalResult<T>(
JsonNode
? result, string callbackId)
372
private void ApplyDtoWriteback(
JsonNode
? result, object?[] originalArgs, Type[] argTypes)
Ats\AtsMarshaller.cs (12)
131
public
JsonNode
? MarshalToJson(object? value, AtsTypeRef typeRef)
162
private static
JsonNode
? SerializePrimitive(object value)
187
private static
JsonNode
? SerializeDto(object value)
190
return
JsonNode
.Parse(json);
193
private
JsonNode
? SerializeArray(object value, AtsTypeRef? elementType)
216
public
JsonNode
? MarshalToJson(object? value)
244
private
JsonNode
? SerializeArrayRuntime(object value)
254
private
JsonNode
? SerializeCancellationToken(CancellationToken cancellationToken)
265
private
JsonNode
? MarshalListHandle(object value, Type type)
280
private
JsonNode
? MarshalDictHandle(object value, Type type)
303
public object? UnmarshalFromJson(
JsonNode
? node, Type targetType, UnmarshalContext context)
614
if (!source.TryGetPropertyValue(prop.Name, out
var
jsonValue))
Ats\CapabilityDispatcher.cs (15)
19
internal delegate Task<
JsonNode
?> CapabilityHandler(
156
if (args == null || !args.TryGetPropertyValue("context", out
var
contextNode))
193
if (args == null || !args.TryGetPropertyValue("context", out
var
contextNode))
209
if (!args.TryGetPropertyValue("value", out
var
valueNode))
226
return Task.FromResult<
JsonNode
?>(new JsonObject
253
if (args == null || !args.TryGetPropertyValue("context", out
var
contextNode))
276
if (args.TryGetPropertyValue(paramName, out
var
argNode))
343
if (args != null && args.TryGetPropertyValue(paramName, out
var
argNode))
412
public async Task<
JsonNode
?> InvokeAsync(string capabilityId, JsonObject? args)
455
public
JsonNode
? Invoke(string capabilityId, JsonObject? args)
604
if (!args.TryGetPropertyValue(name, out
var
node) || node is not JsonValue value)
618
if (args.TryGetPropertyValue(name, out
var
node) && node is JsonValue value)
630
if (args.TryGetPropertyValue(name, out
var
node) && node is JsonValue value)
646
if (!args.TryGetPropertyValue(name, out
var
node))
673
if (args.TryGetPropertyValue(name, out
var
node) && node is JsonObject obj)
Ats\HandleRegistry.cs (3)
196
public static HandleRef? FromJsonNode(
JsonNode
? node)
198
if (node is JsonObject obj && obj.TryGetPropertyValue("$handle", out
var
handleNode))
212
public static bool IsHandleRef(
JsonNode
? node)
Ats\ReferenceExpressionRef.cs (16)
50
public
JsonNode
?[]? ValueProviders { get; init; }
53
public
JsonNode
? Condition { get; init; }
54
public
JsonNode
? WhenTrue { get; init; }
55
public
JsonNode
? WhenFalse { get; init; }
69
public static ReferenceExpressionRef? FromJsonNode(
JsonNode
? node)
71
if (node is not JsonObject obj || !obj.TryGetPropertyValue("$expr", out
var
exprNode))
82
if (exprObj.TryGetPropertyValue("condition", out
var
conditionNode))
84
exprObj.TryGetPropertyValue("whenTrue", out
var
whenTrueNode);
85
exprObj.TryGetPropertyValue("whenFalse", out
var
whenFalseNode);
88
if (exprObj.TryGetPropertyValue("matchValue", out
var
matchValueNode) &&
105
if (!exprObj.TryGetPropertyValue("format", out
var
formatNode) ||
113
JsonNode
?[]? valueProviders = null;
114
if (exprObj.TryGetPropertyValue("valueProviders", out
var
providersNode) &&
117
valueProviders = new
JsonNode
?[providersArray.Count];
136
public static bool IsReferenceExpressionRef(
JsonNode
? node)
218
var
providerNode = ValueProviders[i];
ICallbackInvoker.cs (2)
22
Task<TResult> InvokeAsync<TResult>(string callbackId,
JsonNode
? args, CancellationToken cancellationToken = default);
30
Task InvokeAsync(string callbackId,
JsonNode
? args, CancellationToken cancellationToken = default);
JsonRpcCallbackInvoker.cs (2)
31
public async Task<TResult> InvokeAsync<TResult>(string callbackId,
JsonNode
? args, CancellationToken cancellationToken = default)
55
public async Task InvokeAsync(string callbackId,
JsonNode
? args, CancellationToken cancellationToken = default)
RemoteAppHostService.cs (2)
70
public async Task<
JsonNode
?> InvokeCapabilityAsync(string capabilityId, JsonObject? args)
76
var
result = await _capabilityDispatcher.InvokeAsync(capabilityId, args).ConfigureAwait(false);
Aspire.Hosting.RemoteHost.Tests (103)
AtsMarshallerTests.cs (26)
91
var
result = marshaller.MarshalToJson(null);
101
var
result = marshaller.MarshalToJson("hello");
112
var
result = marshaller.MarshalToJson(42);
123
var
result = marshaller.MarshalToJson(true);
134
var
result = marshaller.MarshalToJson(TestEnum.ValueB);
145
var
result = marshaller.MarshalToJson(TimeSpan.FromSeconds(1.5));
157
var
result = marshaller.MarshalToJson(array);
175
var
result = marshaller.MarshalToJson(cts.Token);
196
var
result = marshaller.MarshalToJson(cts.Token, typeRef);
366
var
result = marshaller.MarshalToJson(dateOnly);
389
var
result = marshaller.MarshalToJson(timeOnly);
410
var
result = marshaller.MarshalToJson(9223372036854775807L);
421
var
result = marshaller.MarshalToJson(3.14159);
433
var
result = marshaller.MarshalToJson(guid);
445
var
result = marshaller.MarshalToJson(list);
464
var
result = marshaller.MarshalToJson(dict);
483
var
result = marshaller.MarshalToJson(obj);
614
var
result = marshaller.MarshalToJson(dto);
696
var
result = marshaller.MarshalToJson(dto);
712
var
result = marshaller.MarshalToJson(parent);
732
var
result = marshaller.MarshalToJson(dto, typeRef);
748
var
result = marshaller.MarshalToJson(parent);
984
var
result = marshaller.MarshalToJson(conditional);
1003
var
json = marshaller.MarshalToJson(conditional);
1023
var
json = marshaller.MarshalToJson(conditional);
1042
var
json = marshaller.MarshalToJson(conditional);
CallbackProxyTests.cs (4)
412
public List<(string CallbackId,
JsonNode
? Args)> Invocations { get; } = [];
413
public
JsonNode
? ResultToReturn { get; set; }
417
public Task<TResult> InvokeAsync<TResult>(string callbackId,
JsonNode
? args, CancellationToken cancellationToken = default)
427
public Task InvokeAsync(string callbackId,
JsonNode
? args, CancellationToken cancellationToken = default)
CapabilityDispatcherTests.cs (66)
18
CapabilityHandler handler = (args, handles) => Task.FromResult<
JsonNode
?>(JsonValue.Create("result"));
37
dispatcher.Register("test/cap1@1", (_, _) => Task.FromResult<
JsonNode
?>(null));
38
dispatcher.Register("test/cap2@1", (_, _) => Task.FromResult<
JsonNode
?>(null));
54
return Task.FromResult<
JsonNode
?>(JsonValue.Create("success"));
70
return Task.FromResult<
JsonNode
?>(null);
82
dispatcher.Register("test/capability@1", (_, _) => Task.FromResult<
JsonNode
?>(JsonValue.Create(42)));
84
var
result = dispatcher.Invoke("test/capability@1", null);
109
return Task.FromResult<
JsonNode
?>(null);
128
return Task.FromResult<
JsonNode
?>(null);
146
return Task.FromResult<
JsonNode
?>(null);
170
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/testMethod", args);
182
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withOptional", args);
194
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withOptional", args);
235
var
nameResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestContextType.name", args);
236
var
countResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestContextType.count", args);
291
var
tokenResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestCancellationTokenContext.cancellationToken", getArgs);
297
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/canObserveCancellation", invokeArgs);
352
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestParentContextType.nestedContext", args);
369
var
operationResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestNestedContextType.operation", nestedArgs);
543
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestTypeWithMethods.calculateSum", args);
563
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestTypeWithMethods.processAsync", args);
583
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestTypeWithMethods.processValueTaskAsync", args);
595
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/asyncValueTaskWithResult", args);
640
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withCallback", args);
706
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/withAsyncCallback", args);
718
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/syncInlineThreadProbe", null);
730
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/syncBackgroundThreadProbe", null);
742
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/valueTaskBackgroundThreadProbe", null);
810
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/asyncWithResult", args);
839
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/sumArray", args);
851
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnArray", args);
871
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptReadOnlyList", args);
884
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptUnion", args);
896
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptUnion", args);
909
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null);
925
var
listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null);
936
var
result = dispatcher.Invoke("Aspire.Hosting/List.get", args);
949
var
listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null);
959
var
removeResult = dispatcher.Invoke("Aspire.Hosting/List.removeAt", removeArgs);
969
var
lengthResult = dispatcher.Invoke("Aspire.Hosting/List.length", lengthArgs);
982
var
listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null);
991
var
result = dispatcher.Invoke("Aspire.Hosting/List.length", args);
1004
var
listResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableList", null);
1020
var
lengthResult = dispatcher.Invoke("Aspire.Hosting/List.length", lengthArgs);
1033
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null);
1049
var
dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null);
1060
var
result = dispatcher.Invoke("Aspire.Hosting/Dict.get", args);
1073
var
dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null);
1083
var
removeResult = dispatcher.Invoke("Aspire.Hosting/Dict.remove", removeArgs);
1093
var
countResult = dispatcher.Invoke("Aspire.Hosting/Dict.count", countArgs);
1106
var
dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null);
1116
var
hasResult = dispatcher.Invoke("Aspire.Hosting/Dict.has", hasArgs);
1127
var
hasResult2 = dispatcher.Invoke("Aspire.Hosting/Dict.has", hasArgs2);
1140
var
dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null);
1149
var
result = dispatcher.Invoke("Aspire.Hosting/Dict.keys", args);
1166
var
dictResult = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnMutableDict", null);
1175
var
result = dispatcher.Invoke("Aspire.Hosting/Dict.count", args);
1192
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptEnum", args);
1209
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptEnum", args);
1226
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/returnEnum", args);
1243
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptOptionalEnum", args);
1255
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptOptionalEnum", new JsonObject());
1326
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithProperties.color", args);
1367
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithMethods.greet", args);
1384
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithProperties.color", args);
1401
var
result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/TestResourceWithProperties.name", args);
ReferenceExpressionRefTests.cs (7)
135
var valueProviders = new
JsonNode
?[]
156
var valueProviders = new
JsonNode
?[]
173
var valueProviders = new
JsonNode
?[]
195
var valueProviders = new
JsonNode
?[]
216
var valueProviders = new
JsonNode
?[]
231
private sealed class ReferenceExpressionRef_Accessor(string format,
JsonNode
?[]? valueProviders)
247
foreach (
var
p in valueProviders)
Aspire.Hosting.Seq.Tests (3)
AddSeqTests.cs (3)
92
var
manifest = await ManifestUtils.GetManifest(seq.Resource);
253
var
manifest = await ManifestUtils.GetManifest(seq.Resource);
283
var
manifest = await ManifestUtils.GetManifest(seq.Resource);
Aspire.Hosting.SqlServer.Tests (3)
AddSqlServerTests.cs (3)
129
var
serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
130
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
170
var
serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
Aspire.Hosting.Tests (58)
AddConnectionStringTests.cs (1)
31
var
connectionStringManifest = await ManifestUtils.GetManifest(connectionStringResource).DefaultTimeout();
AddParameterTests.cs (5)
103
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout();
155
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout();
225
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout();
282
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "val")).DefaultTimeout();
310
var
connectionStringManifest = await ManifestUtils.GetManifest(connectionStringResource).DefaultTimeout();
Dashboard\DashboardResourceTests.cs (1)
654
var
manifest = await ManifestUtils.GetManifestOrNull(dashboard).DefaultTimeout();
ExecutableResourceTests.cs (1)
68
var
manifest = await ManifestUtils.GetManifest(exe2.Resource).DefaultTimeout();
ExternalServiceTests.cs (1)
471
var
manifest = await ManifestUtils.GetManifest(project.Resource);
KestrelConfigTests.cs (4)
177
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
219
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
288
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
308
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
ManifestGenerationTests.cs (5)
104
var
redisManifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout();
547
var
manifest = await ManifestUtils.GetManifest(param.Resource).DefaultTimeout();
573
var
destManifest = await ManifestUtils.GetManifest(destContainer.Resource).DefaultTimeout();
616
var
destManifest = await ManifestUtils.GetManifest(destContainer.Resource).DefaultTimeout();
667
var
destManifest = await ManifestUtils.GetManifest(destContainer.Resource).DefaultTimeout();
Orchestrator\ParameterProcessorTests.cs (4)
1267
Assert.True(capturingStateManager.State.TryGetPropertyValue("ConnectionStrings:mydb", out
var
valueNode));
1308
Assert.True(capturingStateManager.State.TryGetPropertyValue("Parameters:myparam", out
var
valueNode));
1352
Assert.True(capturingStateManager.State.TryGetPropertyValue("MyCustomSection:MyCustomKey", out
var
valueNode));
1584
var sectionData = _unflattenedState.TryGetPropertyValue(sectionName, out
var
sectionNode) && sectionNode is JsonObject obj
ProjectResourceTests.cs (2)
538
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
586
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
PublishAsConnectionStringTests.cs (1)
21
var
manifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout();
PublishAsDockerfileTests.cs (5)
31
var
manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout();
77
var
manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout();
126
var
manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout();
175
var
manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout();
235
var
manifest = await ManifestUtils.GetManifest(project.Resource, manifestDirectory: path).DefaultTimeout();
Schema\SchemaTests.cs (4)
796
var
manifestJson =
JsonNode
.Parse(manifestText);
809
var
manifestJson =
JsonNode
.Parse(manifestText);
Utils\ManifestUtils.cs (14)
13
public static async Task<
JsonNode
> GetManifest(IResource resource, string? manifestDirectory = null)
15
var
node = await GetManifestOrNull(resource, manifestDirectory);
20
public static async Task<
JsonNode
?> GetManifestOrNull(IResource resource, string? manifestDirectory = null)
39
var
obj =
JsonNode
.Parse(ms);
41
var
resourceNode = obj[resource.Name];
45
public static async Task<
JsonNode
> GetManifestForModel(DistributedApplicationModel model, string? manifestDirectory = null)
61
var
obj =
JsonNode
.Parse(ms);
66
public static async Task<
JsonNode
[]> GetManifests(IResource[] resources)
77
var results = new List<
JsonNode
>();
86
var
obj =
JsonNode
.Parse(ms);
88
var
resourceNode = obj[r.Name];
WithEndpointTests.cs (10)
254
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
282
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
309
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
336
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
363
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
390
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
417
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
448
var
manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout();
516
var
manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout();
671
var
manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout();
Aspire.Hosting.Valkey.Tests (2)
AddValkeyTests.cs (2)
127
var
manifest = await ManifestUtils.GetManifest(valkey.Resource);
165
var
manifest = await ManifestUtils.GetManifest(valkey.Resource);
Aspire.Hosting.Yarp (3)
YarpJsonConfigGeneratorBuilder.cs (3)
84
var
jsonProxyConfig = jsonObject["ReverseProxy"] = new JsonObject();
100
var
node = JsonSerializer.SerializeToNode(route, _serializerOptions);
114
var
node = JsonSerializer.SerializeToNode(cluster, _serializerOptions);
ConfigurationSchemaGenerator (15)
ConfigSchemaEmitter.cs (15)
119
var
backupTypeNode = currentNode["type"];
174
var
existingValue = propertiesNode[pathSegment];
240
var
backupTypeNode = currentNode["type"];
284
var
backupPropertyNode = currentNode[property.ConfigurationKeyName];
315
var
backupTypeNode = currentNode["type"];
316
var
backupContainerNode = currentNode[containerName];
334
private static void RestoreBackup(
JsonNode
? backupNode, string name, JsonObject parentNode)
449
var
propertyNodeType = propertyNode["type"];
718
private static void ReplaceNodeWithKeyCasingChange(JsonObject jsonObject, string key,
JsonNode
value)
729
private sealed class SchemaOrderJsonNodeConverter : JsonConverter<
JsonNode
>
733
public override bool CanConvert(Type typeToConvert) => typeof(
JsonNode
).IsAssignableFrom(typeToConvert) && typeToConvert != typeof(JsonValue);
735
public override void Write(Utf8JsonWriter writer,
JsonNode
? value, JsonSerializerOptions options)
742
IEnumerable<KeyValuePair<string,
JsonNode
>> properties =
756
foreach (
var
item in array)
771
public override
JsonNode
? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
ConfigurationSchemaGenerator.Tests (4)
GeneratorTests.cs (4)
1579
var
actualJson =
JsonNode
.Parse(actual)!;
1580
var
expectedJson =
JsonNode
.Parse(expected)!;
dotnet (7)
CliSchema.cs (1)
94
var
node = s_jsonContext.Options.GetJsonSchemaAsNode(typeof(RootCommandDetails), new JsonSchemaExporterOptions());
Commands\New\MSBuildEvaluation\ProjectCapabilityConstraint.cs (2)
73
JsonNode
? token;
76
token =
JsonNode
.Parse(args!);
Telemetry\TelemetryDiskLogger.cs (3)
55
var
root =
JsonNode
.Parse(jsonText)!;
57
activitiesArray.AddRange(activies.Select(r =>
JsonNode
.Parse(JsonSerializer.Serialize(CreateActivityJsonModel(r), s_jsonContext.ActivityModel))));
ToolPackage\ToolPackageDownloaderBase.cs (1)
390
var jsonObject =
JsonNode
.Parse(existingJson)!.AsObject();
dotnet-user-jwts (1)
Helpers\SigningKeysHandler.cs (1)
85
var
toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
Microsoft.Extensions.AI (1)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
220
static
JsonNode
? JsonElementToJsonNode(JsonElement element) =>
Microsoft.Extensions.AI.Abstractions (73)
Functions\AIFunctionFactory.cs (7)
83
/// or <see cref="
JsonNode
"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided,
156
/// or <see cref="
JsonNode
"/>, it is deserialized into the parameter type, utilizing <paramref name="serializerOptions"/> if provided, or else
241
/// or <see cref="
JsonNode
"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided,
321
/// or <see cref="
JsonNode
"/>, it is deserialized into the parameter type, utilizing <paramref name="serializerOptions"/> if provided, or else
378
/// <see cref="JsonDocument"/>, or <see cref="
JsonNode
"/>, it is deserialized directly. If the argument is anything else unknown,
419
/// or <see cref="
JsonNode
"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided,
845
JsonNode
node => JsonSerializer.Deserialize(node, typeInfo),
Utilities\AIJsonSchemaCreateOptions.cs (2)
25
public Func<AIJsonSchemaCreateContext,
JsonNode
,
JsonNode
>? TransformSchemaNode { get; init; }
Utilities\AIJsonSchemaTransformOptions.cs (2)
17
public Func<AIJsonSchemaTransformContext,
JsonNode
,
JsonNode
>? TransformSchemaNode { get; init; }
Utilities\AIJsonUtilities.cs (3)
114
JsonNode
? jsonNode = JsonSerializer.SerializeToNode(value, jti);
162
static void NormalizeJsonNode(
JsonNode
? node)
167
foreach (
JsonNode
? item in array)
Utilities\AIJsonUtilities.Defaults.cs (2)
86
[JsonSerializable(typeof(
JsonNode
))]
172
[JsonSerializable(typeof(
JsonNode
))]
Utilities\AIJsonUtilities.Schema.Create.cs (36)
121
JsonNode
parameterSchema = CreateJsonSchemaCore(
138
(requiredProperties ??= []).Add((
JsonNode
)parameter.Name);
142
JsonNode
schema = new JsonObject();
193
JsonNode
schema = CreateJsonSchemaCore(type, parameter: null, nullabilityContext: null, description, hasDefaultValue, defaultValue, serializerOptions, inferenceOptions);
216
private static
JsonNode
CreateJsonSchemaCore(
242
JsonNode
? defaultValueNode = defaultValue is not null
270
JsonNode
TransformSchemaNode(JsonSchemaExporterContext schemaExporterContext,
JsonNode
schema)
283
if (parameter?.Name is not null && objSchema.TryGetPropertyValue(RefPropertyName, out
JsonNode
? paramName))
292
objSchema[RefPropertyName] = (
JsonNode
)refUri;
319
obj[TypePropertyName] = new JsonArray { (
JsonNode
)numericType, (
JsonNode
)"null" };
323
obj[TypePropertyName] = (
JsonNode
)numericType;
334
if (objSchema.TryGetPropertyValue(TypePropertyName, out
JsonNode
? typeKeyWord) &&
340
objSchema[TypePropertyName] = new JsonArray { (
JsonNode
)typeValue, (
JsonNode
)"null" };
347
objSchema.InsertAtStart(TypePropertyName, new JsonArray { (
JsonNode
)"string", (
JsonNode
)"null" });
355
if (objSchema.TryGetPropertyValue(TypePropertyName, out
JsonNode
? typeKeyWord) &&
361
objSchema[TypePropertyName] = new JsonArray { (
JsonNode
)typeValue, (
JsonNode
)"null" };
369
JsonNode
? defaultValueNode = JsonSerializer.SerializeToNode(defaultValue, ctx.TypeInfo);
376
ConvertSchemaToObject(ref schema).InsertAtStart(DescriptionPropertyName, (
JsonNode
)localDescription);
382
ConvertSchemaToObject(ref schema).InsertAtStart(SchemaPropertyName, (
JsonNode
)SchemaKeywordUri);
395
static JsonObject ConvertSchemaToObject(ref
JsonNode
schema)
415
void ApplyDataAnnotations(ref
JsonNode
schema, AIJsonSchemaCreateContext ctx)
488
JsonNode
? minNode = null;
489
JsonNode
? maxNode = null;
558
JsonArray? requiredArray = requiredSchemaObj.TryGetPropertyValue(RequiredPropertyName, out
JsonNode
? existing) ?
571
foreach (
JsonNode
? entry in requiredArray)
582
requiredArray.Add((
JsonNode
)propertyName);
637
JsonNode
? notNode = obj[NotPropertyName];
707
if (!schema.TryGetPropertyValue(TypePropertyName, out
JsonNode
? typeNode))
720
foreach (
JsonNode
? entry in (JsonArray)typeNode)
777
foreach (
JsonNode
? entry in typeArray)
812
private static void InsertAtStart(this JsonObject jsonObject, string key,
JsonNode
value)
Utilities\AIJsonUtilities.Schema.Transform.cs (21)
32
JsonNode
? nodeSchema = JsonSerializer.SerializeToNode(schema, JsonContext.Default.JsonElement);
33
JsonNode
transformedSchema = TransformSchema(nodeSchema, transformOptions);
37
private static
JsonNode
TransformSchema(
JsonNode
? schema, AIJsonSchemaTransformOptions transformOptions)
43
private static
JsonNode
TransformSchemaCore(
JsonNode
? schema, AIJsonSchemaTransformOptions transformOptions, List<string>? path)
50
schema = new JsonObject { [NotPropertyName] = (
JsonNode
)true };
68
if (schemaObj.TryGetPropertyValue(PropertiesPropertyName, out
JsonNode
? props) && props is JsonObject propsObj)
82
if (schemaObj.TryGetPropertyValue(ItemsPropertyName, out
JsonNode
? itemsSchema))
89
if (schemaObj.TryGetPropertyValue(AdditionalPropertiesPropertyName, out
JsonNode
? additionalProps) &&
97
if (schemaObj.TryGetPropertyValue(NotPropertyName, out
JsonNode
? notSchema))
108
if (schemaObj.TryGetPropertyValue(combinatorKeyword, out
JsonNode
? combinatorSchema) && combinatorSchema is JsonArray combinatorArray)
114
JsonNode
element = TransformSchemaCore(combinatorArray[i], transformOptions, path);
130
schemaObj[AdditionalPropertiesPropertyName] = (
JsonNode
)false;
138
requiredProps.Add((
JsonNode
)prop.Key);
145
schemaObj.TryGetPropertyValue(TypePropertyName, out
JsonNode
? typeSchema) &&
151
foreach (
JsonNode
? typeNode in typeArray)
172
schemaObj["type"] = (
JsonNode
)foundType;
173
schemaObj["nullable"] = (
JsonNode
)true;
178
schemaObj.TryGetPropertyValue(DefaultPropertyName, out
JsonNode
? defaultSchema))
180
string? description = schemaObj.TryGetPropertyValue(DescriptionPropertyName, out
JsonNode
? descriptionSchema) ? descriptionSchema?.GetValue<string>() : null;
Microsoft.Extensions.AI.Abstractions.Tests (40)
AssertExtensions.cs (1)
99
if (!
JsonNode
.DeepEquals(
Contents\FunctionCallContentTests.cs (8)
93
var
json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options);
100
JsonNode
? informationalOnlyValue = null;
101
if (jsonObj.TryGetPropertyValue("informationalOnly", out
var
value1))
105
else if (jsonObj.TryGetPropertyValue("InformationalOnly", out
var
value2))
149
var
json = JsonSerializer.SerializeToNode(original, TestJsonSerializerContext.Default.Options);
167
var
json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options);
257
var arguments = JsonSerializer.Deserialize<Dictionary<string,
JsonNode
>>("""
314
AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string,
JsonNode
>>("""
test\Shared\JsonSchemaExporter\SchemaTestHelpers.cs (11)
17
public static void AssertEqualJsonSchema(
JsonNode
expectedJsonSchema,
JsonNode
actualJsonSchema)
19
if (!
JsonNode
.DeepEquals(expectedJsonSchema, actualJsonSchema))
31
public static void AssertDocumentMatchesSchema(
JsonNode
schema,
JsonNode
? instance)
52
public static void AssertDoesNotMatchSchema(
JsonNode
schema,
JsonNode
? instance)
67
private static EvaluationResults EvaluateSchemaCore(
JsonNode
schema,
JsonNode
? instance)
74
private static string FormatJson(
JsonNode
? node) =>
78
[JsonSerializable(typeof(
JsonNode
))]
test\Shared\JsonSchemaExporter\TestData.cs (3)
30
JsonNode
ITestData.ExpectedJsonSchema { get; } =
31
JsonNode
.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions)
63
JsonNode
ExpectedJsonSchema { get; }
test\Shared\JsonSchemaExporter\TestTypes.cs (6)
103
yield return new TestData<
JsonNode
>(
JsonNode
.Parse("""[{ "x" : 42 }]"""), "true");
106
yield return new TestData<JsonArray>([(
JsonNode
)1, (
JsonNode
)2, (
JsonNode
)3], """{"type":["array","null"]}""");
1247
[JsonSerializable(typeof(
JsonNode
))]
TestJsonSerializerContext.cs (1)
32
[JsonSerializable(typeof(Dictionary<string,
JsonNode
>))] // Used in Content tests
Utilities\AIJsonUtilitiesTests.cs (10)
100
case null when property.PropertyType == typeof(Func<AIJsonSchemaCreateContext,
JsonNode
,
JsonNode
>):
101
Func<AIJsonSchemaCreateContext,
JsonNode
,
JsonNode
> transformer = static (context, schema) => (
JsonNode
)true;
606
JsonNode
? schemaAsNode = JsonSerializer.SerializeToNode(schema, options);
619
JsonNode
? serializedValue = JsonSerializer.SerializeToNode(testData.Value, testData.Type, options);
1586
schemaObj.Add("myAwesomeKeyword", (
JsonNode
)42);
1602
if (schemaObj.TryGetPropertyValue("properties", out
JsonNode
? props))
1609
if (schemaObj.TryGetPropertyValue("type", out
JsonNode
? type) && type is JsonArray typeArray)
Microsoft.Extensions.AI.Evaluation.Quality (5)
AIToolExtensions.cs (3)
24
JsonNode
functionJsonNode =
29
["functionSchema"] =
JsonNode
.Parse(function.JsonSchema.GetRawText()),
35
JsonNode
.Parse(function.ReturnJsonSchema.Value.GetRawText());
ChatMessageExtensions.cs (1)
21
JsonNode
? messageJsonNode =
ChatResponseExtensions.cs (1)
36
JsonNode
? toolCallOrResultJsonNode =
Microsoft.Extensions.AI.Evaluation.Safety (4)
EvaluationMetricExtensions.cs (4)
81
JsonNode
? jsonData =
JsonNode
.Parse(data);
87
Failed to parse supplied {nameof(data)} below into a {nameof(
JsonNode
)}.
97
internal static void LogJsonData(this EvaluationMetric metric,
JsonNode
data)
Microsoft.Extensions.AI.Integration.Tests (5)
VerbatimHttpHandler.cs (5)
108
JsonNode
? expectedNode = null;
109
JsonNode
? actualNode = null;
112
expectedNode =
JsonNode
.Parse(expected);
113
actualNode =
JsonNode
.Parse(actual);
121
if (!
JsonNode
.DeepEquals(expectedNode, actualNode))
Microsoft.Extensions.AI.OpenAI (1)
OpenAIClientExtensions.cs (1)
96
static 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)
99
if (!
JsonNode
.DeepEquals(
Microsoft.Extensions.AI.Tests (3)
Functions\AIFunctionFactoryTest.cs (1)
135
["y"] =
JsonNode
.Parse("2"),
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (1)
99
if (!
JsonNode
.DeepEquals(
TestJsonSerializerContext.cs (1)
23
[JsonSerializable(typeof(Dictionary<string,
JsonNode
>))]
Microsoft.ML.AutoML (12)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (3)
17
var
jValue = JsonValue.Parse(ref reader);
26
var
jsonObject =
JsonNode
.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
18
var
jsonObject = JsonValue.Parse(ref reader);
29
var
jObject = JsonObject.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (4)
17
var
jNode =
JsonNode
.Parse(ref reader);
29
var
jNode =
JsonNode
.Parse("{}");
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
17
var
jValue = JsonValue.Parse(ref reader);
27
var
jsonObject =
JsonNode
.Parse("{}");
Microsoft.ML.AutoML.SourceGenerator (5)
SearchSpaceGenerator.cs (5)
35
var searchSpacesJNodes = searchSpacesJson.Select(x =>
JsonNode
.Parse(x));
37
foreach (
var
jNode in searchSpacesJNodes)
65
var
defaultToken = t.AsObject().ContainsKey("default") ? t["default"] : null;
86
var
searchSpaceNode = t.AsObject().ContainsKey("search_space") ? t["search_space"] : null;
96
var
minToken = searchSpaceNode["min"];
Microsoft.NET.Build.Containers (16)
ImageConfig.cs (9)
41
internal ImageConfig(string imageConfigJson) : this(
JsonNode
.Parse(imageConfigJson)!)
45
internal ImageConfig(
JsonNode
config)
117
if (_config["config"]?[propertyName] is
JsonNode
propertyValue)
122
newConfig[propertyName] =
JsonNode
.Parse(propertyValue.ToJsonString());
151
["history"] = new JsonArray(_history.Select(CreateHistory).ToArray<
JsonNode
>())
156
static JsonArray ToJsonArray(IEnumerable<string> items) => new(items.Where(s => !string.IsNullOrEmpty(s)).Select(s => JsonValue.Create(s)).ToArray<
JsonNode
?>());
237
foreach (KeyValuePair<string,
JsonNode
?> property in portsJson)
256
foreach (KeyValuePair<string,
JsonNode
?> property in labelsJson)
272
foreach (
JsonNode
? entry in envVarJson)
LocalDaemons\DockerCli.cs (1)
391
JsonNode
manifestNode = new JsonArray(new JsonObject
Registry\DefaultBlobOperations.cs (3)
43
public async Task<
JsonNode
> GetJsonAsync(string repositoryName, string digest, CancellationToken cancellationToken)
48
JsonNode
? configDoc =
JsonNode
.Parse(await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false));
Registry\IBlobOperations.cs (1)
20
public Task<
JsonNode
> GetJsonAsync(string repositoryName, string digest, CancellationToken cancellationToken);
Registry\Registry.cs (1)
256
JsonNode
configDoc = await _registryAPI.Blob.GetJsonAsync(repositoryName, configSha, cancellationToken).ConfigureAwait(false);
Tasks\CreateImageIndex.cs (1)
151
var configJson =
JsonNode
.Parse(config) as JsonObject;
Microsoft.TemplateEngine.Cli (52)
Alias\AliasRegistry.cs (4)
156
arr.Add((
JsonNode
)JsonValue.Create(item)!);
180
JsonNode
? element = null;
195
foreach (KeyValuePair<string,
JsonNode
?> property in jObj)
208
foreach (
JsonNode
? item in arr)
HostSpecificDataLoader.cs (2)
48
JsonObject? jObject =
JsonNode
.Parse(hostData, nodeOptions: null, s_jsonDocumentOptions)?.AsObject();
72
jsonData =
JsonNode
.Parse(stream, nodeOptions: null, s_jsonDocumentOptions)?.AsObject();
HostSpecificTemplateData.cs (5)
28
JsonNode
? usagesNode = GetPropertyCaseInsensitive(jObject, nameof(UsageExamples));
36
JsonNode
? symbolsNode = GetPropertyCaseInsensitive(jObject, nameof(SymbolInfo));
72
JsonNode
? isHiddenNode = GetPropertyCaseInsensitive(jObject, nameof(IsHidden));
190
private static
JsonNode
? GetPropertyCaseInsensitive(JsonObject obj, string key)
192
if (obj.TryGetPropertyValue(key, out
JsonNode
? result))
JExtensions.cs (28)
19
internal static string? ToString(this
JsonNode
? token, string? key)
41
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
50
internal static bool TryGetValue(this
JsonNode
? token, string? key, out
JsonNode
? result)
75
internal static bool TryParseBool(this
JsonNode
token, out bool result)
96
internal static bool ToBool(this
JsonNode
? token, string? key = null, bool defaultValue = false)
98
if (!token.TryGetValue(key, out
JsonNode
? checkToken))
111
internal static int ToInt32(this
JsonNode
? token, string? key = null, int defaultValue = 0)
128
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
137
internal static T ToEnum<T>(this
JsonNode
token, string? key = null, T defaultValue = default)
149
internal static Guid ToGuid(this
JsonNode
token, string? key = null, Guid defaultValue = default)
160
internal static IEnumerable<KeyValuePair<string,
JsonNode
?>> PropertiesOf(this
JsonNode
? token, string? key = null)
164
return Array.Empty<KeyValuePair<string,
JsonNode
?>>();
169
JsonNode
? element = GetPropertyCaseInsensitive(currentJObj, key);
172
return Array.Empty<KeyValuePair<string,
JsonNode
?>>();
180
internal static T? Get<T>(this
JsonNode
? token, string? key)
181
where T :
JsonNode
188
JsonNode
? res = GetPropertyCaseInsensitive(obj, key);
192
internal static IReadOnlyList<string> ArrayAsStrings(this
JsonNode
? token, string? propertyName = null)
206
foreach (
JsonNode
? item in arr)
222
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
226
internal static void WriteObject(this IPhysicalFileSystem fileSystem, string path,
JsonNode
obj)
233
internal static bool TryParse(this string arg, out
JsonNode
? token)
237
token =
JsonNode
.Parse(arg, null, DocOptions);
247
private static bool TryParseInt(this
JsonNode
token, out int result)
267
private static
JsonNode
? GetPropertyCaseInsensitive(JsonObject obj, string key)
269
if (obj.TryGetPropertyValue(key, out
JsonNode
? result))
PostActionProcessors\AddJsonPropertyPostActionProcessor.cs (10)
152
JsonNode
? newJsonContent = AddElementToJson(
173
private static
JsonNode
? AddElementToJson(IPhysicalFileSystem fileSystem, string targetJsonFile, string? propertyPath, string propertyPathSeparator, string newJsonPropertyName, string newJsonPropertyValue, IPostAction action)
176
JsonNode
? jsonContent =
JsonNode
.Parse(fileContent, nodeOptions: null, documentOptions: DeserializerOptions);
190
JsonNode
? parentProperty = FindJsonNode(jsonContent, propertyPath, propertyPathSeparator, createPath);
200
parentProperty[newJsonPropertyName] =
JsonNode
.Parse(newJsonPropertyValue);
210
private static
JsonNode
? FindJsonNode(
JsonNode
content, string? nodePath, string pathSeparator, bool createPath)
219
JsonNode
? node = content;
228
JsonNode
? childNode = node[property];
PostActionProcessors\ChmodPostActionProcessor.cs (1)
25
JsonArray valueArray =
JsonNode
.Parse(entry.Value)!.AsArray();
PostActionProcessors\PostActionProcessorBase.cs (1)
126
targetFiles.TryParse(out
JsonNode
? config);
TemplateSearch\CliHostSearchCacheData.cs (1)
36
foreach (KeyValuePair<string,
JsonNode
?> data in cacheObject)
Microsoft.TemplateEngine.Edge (80)
BuiltInManagedProvider\GlobalSettings.cs (1)
86
foreach (
var
package in jObject.Get<JsonArray>(nameof(GlobalSettingsData.Packages)) ?? new JsonArray())
Constraints\ConstraintsExtensions.cs (6)
20
JsonNode
token = ParseConstraintJsonNode(args);
54
JsonNode
token = ParseConstraintJsonNode(args);
113
private static
JsonNode
ParseConstraintJsonNode(this string? args)
120
JsonNode
? token;
123
token =
JsonNode
.Parse(args!);
133
private static JsonArray ToConstraintsJsonArray(this
JsonNode
token, string? args, bool isStringTypeAllowed)
Settings\SettingsStore.cs (5)
21
if (obj.TryGetValueCaseInsensitive(nameof(ComponentGuidToAssemblyQualifiedName), out
JsonNode
? componentGuidToAssemblyQualifiedNameToken))
35
if (obj.TryGetValueCaseInsensitive(nameof(ProbingPaths), out
JsonNode
? probingPathsToken))
39
foreach (
JsonNode
? path in probingPathsArray)
49
if (obj.TryGetValueCaseInsensitive(nameof(ComponentTypeToGuidList), out
JsonNode
? componentTypeToGuidListToken))
60
foreach (
JsonNode
? value in values)
Settings\TemplateCache.cs (5)
76
if (contentJObject != null && contentJObject.TryGetValueCaseInsensitive(nameof(Version), out
JsonNode
? versionToken))
89
Locale = contentJObject.TryGetValueCaseInsensitive(nameof(Locale), out
JsonNode
? localeToken)
95
if (contentJObject.TryGetValueCaseInsensitive(nameof(MountPointsInfo), out
JsonNode
? mountPointInfoToken) && mountPointInfoToken is JsonObject mountPointInfoObj)
110
if (contentJObject.TryGetValueCaseInsensitive(nameof(TemplateInfo), out
JsonNode
? templateInfoToken) && templateInfoToken is JsonArray arr)
112
foreach (
JsonNode
? entry in arr)
Settings\TemplateInfoReader.cs (6)
23
JsonNode
? shortNameToken = entry.Get<
JsonNode
>(nameof(ShortNameList));
34
foreach (
JsonNode
? item in classificationsArray)
80
foreach (
JsonNode
? item in parametersArray)
109
foreach (
JsonNode
? item in postActionsArray)
124
foreach (
JsonNode
? item in constraintsArray)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (57)
27
internal static string? ToString(this
JsonNode
? token, string? key)
49
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
63
internal static bool TryGetValue(this
JsonNode
? token, string? key, out
JsonNode
? result)
88
internal static bool TryParseBool(this
JsonNode
token, out bool result)
109
internal static bool ToBool(this
JsonNode
? token, string? key = null, bool defaultValue = false)
111
if (!token.TryGetValue(key, out
JsonNode
? checkToken))
124
internal static bool TryParseInt(this
JsonNode
token, out int result)
144
internal static int ToInt32(this
JsonNode
? token, string? key = null, int defaultValue = 0)
161
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
170
internal static T ToEnum<T>(this
JsonNode
token, string? key = null, T defaultValue = default, bool ignoreCase = false)
182
internal static Guid ToGuid(this
JsonNode
token, string? key = null, Guid defaultValue = default)
200
JsonNode
? token = jObject.Get<
JsonNode
>(propertyName);
208
internal static IEnumerable<KeyValuePair<string,
JsonNode
?>> PropertiesOf(this
JsonNode
? token, string? key = null)
217
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
236
private static IReadOnlyList<KeyValuePair<string,
JsonNode
?>> GetObjectProperties(JsonObject obj)
256
/// when the internal dictionary has not yet been initialized, so <see cref="
JsonNode
.ToJsonString"/> is
260
private static List<KeyValuePair<string,
JsonNode
?>> GetObjectPropertiesViaDocument(JsonObject obj)
263
var result = new List<KeyValuePair<string,
JsonNode
?>>();
268
var property = new KeyValuePair<string,
JsonNode
?>(prop.Name, ParseJsonNode(prop.Value.GetRawText()));
282
internal static T? Get<T>(this
JsonNode
? token, string? key)
283
where T :
JsonNode
290
JsonNode
? res = GetPropertyCaseInsensitive(obj, key);
294
internal static IReadOnlyDictionary<string, string> ToStringDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
315
internal static IReadOnlyDictionary<string,
JsonNode
> ToJsonNodeDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
317
Dictionary<string,
JsonNode
> result = new(comparer ?? StringComparer.Ordinal);
334
internal static IReadOnlyDictionary<string, string> ToJsonNodeStringDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
349
internal static TemplateParameterPrecedence ToTemplateParameterPrecedence(this
JsonNode
jObject, string? key)
351
if (!jObject.TryGetValue(key, out
JsonNode
? checkToken))
364
internal static IReadOnlyList<string> ArrayAsStrings(this
JsonNode
? token, string? propertyName = null)
378
foreach (
JsonNode
? item in arr)
389
internal static IReadOnlyList<Guid> ArrayAsGuids(this
JsonNode
? token, string? propertyName = null)
403
foreach (
JsonNode
? item in arr)
417
internal static IEnumerable<T> Items<T>(this
JsonNode
? token, string? propertyName = null)
418
where T :
JsonNode
430
foreach (
JsonNode
? item in arr)
444
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
453
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
463
internal static IReadOnlyList<string> JTokenStringOrArrayToCollection(this
JsonNode
? token, IReadOnlyList<string> defaultSet)
503
internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out
JsonNode
? result)
513
internal static
JsonNode
? GetPropertyCaseInsensitive(JsonObject obj, string key)
518
if (obj.TryGetPropertyValue(key, out
JsonNode
? result))
546
private static
JsonNode
? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
551
JsonNode
? result = null;
552
JsonNode
? caseInsensitiveResult = null;
576
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
583
internal static
JsonNode
? ParseJsonNode(string json)
585
return
JsonNode
.Parse(json, null, DocOptions);
599
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
608
return (JsonObject?)
JsonNode
.Parse(source.ToJsonString(), null, DocOptions)
624
&& target.TryGetPropertyValue(property.Key, out
JsonNode
? targetNode)
635
foreach (
var
item in sourceArr)
637
targetArr.Add(item != null ?
JsonNode
.Parse(item.ToJsonString()) : null);
644
?
JsonNode
.Parse(property.Value.ToJsonString())
Microsoft.TemplateEngine.Utils (57)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (57)
27
internal static string? ToString(this
JsonNode
? token, string? key)
49
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
63
internal static bool TryGetValue(this
JsonNode
? token, string? key, out
JsonNode
? result)
88
internal static bool TryParseBool(this
JsonNode
token, out bool result)
109
internal static bool ToBool(this
JsonNode
? token, string? key = null, bool defaultValue = false)
111
if (!token.TryGetValue(key, out
JsonNode
? checkToken))
124
internal static bool TryParseInt(this
JsonNode
token, out int result)
144
internal static int ToInt32(this
JsonNode
? token, string? key = null, int defaultValue = 0)
161
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
170
internal static T ToEnum<T>(this
JsonNode
token, string? key = null, T defaultValue = default, bool ignoreCase = false)
182
internal static Guid ToGuid(this
JsonNode
token, string? key = null, Guid defaultValue = default)
200
JsonNode
? token = jObject.Get<
JsonNode
>(propertyName);
208
internal static IEnumerable<KeyValuePair<string,
JsonNode
?>> PropertiesOf(this
JsonNode
? token, string? key = null)
217
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
236
private static IReadOnlyList<KeyValuePair<string,
JsonNode
?>> GetObjectProperties(JsonObject obj)
256
/// when the internal dictionary has not yet been initialized, so <see cref="
JsonNode
.ToJsonString"/> is
260
private static List<KeyValuePair<string,
JsonNode
?>> GetObjectPropertiesViaDocument(JsonObject obj)
263
var result = new List<KeyValuePair<string,
JsonNode
?>>();
268
var property = new KeyValuePair<string,
JsonNode
?>(prop.Name, ParseJsonNode(prop.Value.GetRawText()));
282
internal static T? Get<T>(this
JsonNode
? token, string? key)
283
where T :
JsonNode
290
JsonNode
? res = GetPropertyCaseInsensitive(obj, key);
294
internal static IReadOnlyDictionary<string, string> ToStringDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
315
internal static IReadOnlyDictionary<string,
JsonNode
> ToJsonNodeDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
317
Dictionary<string,
JsonNode
> result = new(comparer ?? StringComparer.Ordinal);
334
internal static IReadOnlyDictionary<string, string> ToJsonNodeStringDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
349
internal static TemplateParameterPrecedence ToTemplateParameterPrecedence(this
JsonNode
jObject, string? key)
351
if (!jObject.TryGetValue(key, out
JsonNode
? checkToken))
364
internal static IReadOnlyList<string> ArrayAsStrings(this
JsonNode
? token, string? propertyName = null)
378
foreach (
JsonNode
? item in arr)
389
internal static IReadOnlyList<Guid> ArrayAsGuids(this
JsonNode
? token, string? propertyName = null)
403
foreach (
JsonNode
? item in arr)
417
internal static IEnumerable<T> Items<T>(this
JsonNode
? token, string? propertyName = null)
418
where T :
JsonNode
430
foreach (
JsonNode
? item in arr)
444
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
453
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
463
internal static IReadOnlyList<string> JTokenStringOrArrayToCollection(this
JsonNode
? token, IReadOnlyList<string> defaultSet)
503
internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out
JsonNode
? result)
513
internal static
JsonNode
? GetPropertyCaseInsensitive(JsonObject obj, string key)
518
if (obj.TryGetPropertyValue(key, out
JsonNode
? result))
546
private static
JsonNode
? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
551
JsonNode
? result = null;
552
JsonNode
? caseInsensitiveResult = null;
576
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
583
internal static
JsonNode
? ParseJsonNode(string json)
585
return
JsonNode
.Parse(json, null, DocOptions);
599
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
608
return (JsonObject?)
JsonNode
.Parse(source.ToJsonString(), null, DocOptions)
624
&& target.TryGetPropertyValue(property.Key, out
JsonNode
? targetNode)
635
foreach (
var
item in sourceArr)
637
targetArr.Add(item != null ?
JsonNode
.Parse(item.ToJsonString()) : null);
644
?
JsonNode
.Parse(property.Value.ToJsonString())
Microsoft.TemplateSearch.Common (76)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (57)
27
internal static string? ToString(this
JsonNode
? token, string? key)
49
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
63
internal static bool TryGetValue(this
JsonNode
? token, string? key, out
JsonNode
? result)
88
internal static bool TryParseBool(this
JsonNode
token, out bool result)
109
internal static bool ToBool(this
JsonNode
? token, string? key = null, bool defaultValue = false)
111
if (!token.TryGetValue(key, out
JsonNode
? checkToken))
124
internal static bool TryParseInt(this
JsonNode
token, out int result)
144
internal static int ToInt32(this
JsonNode
? token, string? key = null, int defaultValue = 0)
161
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
170
internal static T ToEnum<T>(this
JsonNode
token, string? key = null, T defaultValue = default, bool ignoreCase = false)
182
internal static Guid ToGuid(this
JsonNode
token, string? key = null, Guid defaultValue = default)
200
JsonNode
? token = jObject.Get<
JsonNode
>(propertyName);
208
internal static IEnumerable<KeyValuePair<string,
JsonNode
?>> PropertiesOf(this
JsonNode
? token, string? key = null)
217
JsonNode
? element = GetPropertyCaseInsensitive(obj, key);
236
private static IReadOnlyList<KeyValuePair<string,
JsonNode
?>> GetObjectProperties(JsonObject obj)
256
/// when the internal dictionary has not yet been initialized, so <see cref="
JsonNode
.ToJsonString"/> is
260
private static List<KeyValuePair<string,
JsonNode
?>> GetObjectPropertiesViaDocument(JsonObject obj)
263
var result = new List<KeyValuePair<string,
JsonNode
?>>();
268
var property = new KeyValuePair<string,
JsonNode
?>(prop.Name, ParseJsonNode(prop.Value.GetRawText()));
282
internal static T? Get<T>(this
JsonNode
? token, string? key)
283
where T :
JsonNode
290
JsonNode
? res = GetPropertyCaseInsensitive(obj, key);
294
internal static IReadOnlyDictionary<string, string> ToStringDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
315
internal static IReadOnlyDictionary<string,
JsonNode
> ToJsonNodeDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
317
Dictionary<string,
JsonNode
> result = new(comparer ?? StringComparer.Ordinal);
334
internal static IReadOnlyDictionary<string, string> ToJsonNodeStringDictionary(this
JsonNode
token, StringComparer? comparer = null, string? propertyName = null)
349
internal static TemplateParameterPrecedence ToTemplateParameterPrecedence(this
JsonNode
jObject, string? key)
351
if (!jObject.TryGetValue(key, out
JsonNode
? checkToken))
364
internal static IReadOnlyList<string> ArrayAsStrings(this
JsonNode
? token, string? propertyName = null)
378
foreach (
JsonNode
? item in arr)
389
internal static IReadOnlyList<Guid> ArrayAsGuids(this
JsonNode
? token, string? propertyName = null)
403
foreach (
JsonNode
? item in arr)
417
internal static IEnumerable<T> Items<T>(this
JsonNode
? token, string? propertyName = null)
418
where T :
JsonNode
430
foreach (
JsonNode
? item in arr)
444
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
453
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
463
internal static IReadOnlyList<string> JTokenStringOrArrayToCollection(this
JsonNode
? token, IReadOnlyList<string> defaultSet)
503
internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out
JsonNode
? result)
513
internal static
JsonNode
? GetPropertyCaseInsensitive(JsonObject obj, string key)
518
if (obj.TryGetPropertyValue(key, out
JsonNode
? result))
546
private static
JsonNode
? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
551
JsonNode
? result = null;
552
JsonNode
? caseInsensitiveResult = null;
576
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
583
internal static
JsonNode
? ParseJsonNode(string json)
585
return
JsonNode
.Parse(json, null, DocOptions);
599
return (JsonObject?)
JsonNode
.Parse(json, null, DocOptions)
608
return (JsonObject?)
JsonNode
.Parse(source.ToJsonString(), null, DocOptions)
624
&& target.TryGetPropertyValue(property.Key, out
JsonNode
? targetNode)
635
foreach (
var
item in sourceArr)
637
targetArr.Add(item != null ?
JsonNode
.Parse(item.ToJsonString()) : null);
644
?
JsonNode
.Parse(property.Value.ToJsonString())
TemplateDiscoveryMetadata\BlobStorageTemplateInfo.cs (5)
155
JsonNode
? shortNameToken = entry.Get<
JsonNode
>(nameof(ShortNameList));
167
foreach (
JsonNode
? item in classificationsArray)
198
foreach (
JsonNode
? item in postActionsArray)
214
foreach (
JsonNode
? item in parametersArray)
TemplateDiscoveryMetadata\LegacySearchCacheReader.cs (10)
84
if (cacheObject.TryGetValueCaseInsensitive(nameof(TemplateDiscoveryMetadata.Version), out
JsonNode
? value))
104
if (cacheObject.TryGetValueCaseInsensitive(nameof(TemplateDiscoveryMetadata.TemplateCache), out
JsonNode
? templateInfoToken))
110
foreach (
JsonNode
? entry in arr)
148
JsonNode
? packToTemplateMapToken = JExtensions.GetPropertyCaseInsensitive(cacheObject, nameof(TemplateDiscoveryMetadata.PackToTemplateMap));
165
JsonNode
? versionNode = JExtensions.GetPropertyCaseInsensitive(entryValue, nameof(PackToTemplateEntry.Version));
166
JsonNode
? identificationNode = JExtensions.GetPropertyCaseInsensitive(entryValue, nameof(PackToTemplateEntry.TemplateIdentificationEntry));
173
foreach (
JsonNode
? templateIdentityInfo in identificationArray)
187
if (entryValue.TryGetValueCaseInsensitive(nameof(PackToTemplateEntry.TotalDownloads), out
JsonNode
? totalDownloadsNode)
217
JsonNode
? additionalDataToken = JExtensions.GetPropertyCaseInsensitive(cacheObject, nameof(TemplateDiscoveryMetadata.AdditionalData));
232
JsonNode
? dataNode = JExtensions.GetPropertyCaseInsensitive(additionalDataObject, dataReadInfo.Key);
TemplateSearchCache\TemplatePackageSearchData.Json.cs (2)
33
Owners = jObject.Get<
JsonNode
>(nameof(Owners)).JTokenStringOrArrayToCollection([]);
42
foreach (
JsonNode
? template in templatesData)
TemplateSearchCache\TemplateSearchCache.Json.cs (2)
55
foreach (
JsonNode
? templatePackage in data)
81
JsonNode
? dataNode = JExtensions.GetPropertyCaseInsensitive(cacheObject, dataReadInfo.Key);
MSBuild (3)
JsonOutputFormatter.cs (3)
21
private readonly
JsonNode
_topLevelNode = new JsonObject();
37
JsonNode
propertiesNode = new JsonObject();
55
JsonNode
itemsNode = new JsonObject();
sdk-tasks (13)
GetRuntimePackRids.cs (1)
22
var runtimeJsonRoot =
JsonNode
.Parse(runtimeJsonContents)!.AsObject();
PublishMutationUtilities.cs (4)
17
var
deps =
JsonNode
.Parse(File.ReadAllText(depsFile));
29
var
targetLibraryValue = targetLibrary.Value;
40
var
libraryValue = library.Value;
RemoveAssetFromDepsPackages.cs (3)
34
var
deps =
JsonNode
.Parse(File.ReadAllText(depsFile));
41
var
section = pv.Value![sectionName];
UpdateRuntimeConfig.cs (5)
37
var config =
JsonNode
.Parse(text)!.AsObject();
38
var
frameworks = config["runtimeOptions"]?["frameworks"];
39
var
framework = config["runtimeOptions"]?["framework"];
42
foreach (
var
item in frameworks.AsArray())
55
private void UpdateFramework(
JsonNode
item)
Shared.Tests (20)
JsonSchemaExporter\SchemaTestHelpers.cs (11)
17
public static void AssertEqualJsonSchema(
JsonNode
expectedJsonSchema,
JsonNode
actualJsonSchema)
19
if (!
JsonNode
.DeepEquals(expectedJsonSchema, actualJsonSchema))
31
public static void AssertDocumentMatchesSchema(
JsonNode
schema,
JsonNode
? instance)
52
public static void AssertDoesNotMatchSchema(
JsonNode
schema,
JsonNode
? instance)
67
private static EvaluationResults EvaluateSchemaCore(
JsonNode
schema,
JsonNode
? instance)
74
private static string FormatJson(
JsonNode
? node) =>
78
[JsonSerializable(typeof(
JsonNode
))]
JsonSchemaExporter\TestData.cs (3)
30
JsonNode
ITestData.ExpectedJsonSchema { get; } =
31
JsonNode
.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions)
63
JsonNode
ExpectedJsonSchema { get; }
JsonSchemaExporter\TestTypes.cs (6)
103
yield return new TestData<
JsonNode
>(
JsonNode
.Parse("""[{ "x" : 42 }]"""), "true");
106
yield return new TestData<JsonArray>([(
JsonNode
)1, (
JsonNode
)2, (
JsonNode
)3], """{"type":["array","null"]}""");
1247
[JsonSerializable(typeof(
JsonNode
))]
System.Text.Json (478)
System\Text\Json\Nodes\JsonArray.cs (31)
24
private List<
JsonNode
?>? _list;
39
public JsonArray(JsonNodeOptions options, params
JsonNode
?[] items) : base(options)
49
public JsonArray(JsonNodeOptions options, params ReadOnlySpan<
JsonNode
?> items) : base(options)
58
public JsonArray(params
JsonNode
?[] items) : base()
67
public JsonArray(params ReadOnlySpan<
JsonNode
?> items) : base()
74
internal override
JsonNode
DeepCloneCore()
76
GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement);
87
_list = new List<
JsonNode
?>(list.Count)
98
internal override bool DeepEqualsCore(
JsonNode
node)
108
List<
JsonNode
?> currentList = List;
109
List<
JsonNode
?> otherList = array.List;
131
internal int GetElementIndex(
JsonNode
? node)
137
/// Returns an enumerable that wraps calls to <see cref="
JsonNode
.GetValue{T}"/>.
143
foreach (
JsonNode
? item in List)
149
private void InitializeFromArray(
JsonNode
?[] items)
151
var list = new List<
JsonNode
?>(items);
161
private void InitializeFromSpan(ReadOnlySpan<
JsonNode
?> items)
163
List<
JsonNode
?> list = new(items.Length);
220
JsonNode
? nodeToAdd = ConvertFromValue(value, Options);
227
private List<
JsonNode
?> List => _list ?? InitializeList();
229
private protected override
JsonNode
? GetItem(int index)
234
private protected override void SetItem(int index,
JsonNode
? value)
241
internal override unsafe void GetPath(ref ValueStringBuilder path,
JsonNode
? child)
268
GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement);
278
foreach (
JsonNode
? element in List)
294
private List<
JsonNode
?> InitializeList()
296
GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement);
305
list = new List<
JsonNode
?>(jElement.GetArrayLength());
309
JsonNode
? node = JsonNodeConverter.Create(element, Options);
332
private void GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement)
376
public
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"/>.
22
public void Add(
JsonNode
? item)
34
List<
JsonNode
?>? list = _list;
58
public bool Contains(
JsonNode
? item) => List.Contains(item);
63
/// <param name="item">The <see cref="
JsonNode
"/> to locate in the <see cref="JsonArray"/>.</param>
67
public int IndexOf(
JsonNode
? item) => List.IndexOf(item);
73
/// <param name="item">The <see cref="
JsonNode
"/> to insert.</param>
77
public 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"/>.
92
public bool Remove(
JsonNode
? item)
112
JsonNode
? item = List[index];
125
public int RemoveAll(Func<
JsonNode
?, bool> match)
166
List<
JsonNode
?> list = List;
208
void ICollection<
JsonNode
?>.CopyTo(
JsonNode
?[] array, int index) => List.CopyTo(array, index);
213
/// <returns>A <see cref="IEnumerator{JsonNode}"/> for the <see cref="
JsonNode
"/>.</returns>
214
public IEnumerator<
JsonNode
?> GetEnumerator() => List.GetEnumerator();
227
bool ICollection<
JsonNode
?>.IsReadOnly => false;
231
private 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
"/>.
22
private
JsonNode
? _parent;
118
/// Gets the parent <see cref="
JsonNode
"/>.
122
public
JsonNode
? Parent
151
internal abstract void GetPath(ref ValueStringBuilder path,
JsonNode
? child);
154
/// Gets the root <see cref="
JsonNode
"/>.
159
public
JsonNode
Root
163
JsonNode
? 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"/>.
212
public
JsonNode
? this[int index]
218
private protected virtual
JsonNode
? GetItem(int index)
224
private protected virtual void SetItem(int index,
JsonNode
? node) =>
236
/// The current <see cref="
JsonNode
"/> is not a <see cref="JsonObject"/>.
238
public
JsonNode
? this[string propertyName]
251
/// Creates a new instance of the <see cref="
JsonNode
"/>. All children nodes are recursively cloned.
254
public
JsonNode
DeepClone() => DeepCloneCore();
256
internal 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>
307
public static bool DeepEquals(
JsonNode
? node1,
JsonNode
? node2)
321
internal abstract bool DeepEqualsCore(
JsonNode
node);
332
JsonNode
? node;
346
internal void AssignParent(
JsonNode
parent)
353
JsonNode
? p = parent;
369
/// to support arbitrary <see cref="JsonElement"/> and <see cref="
JsonNode
"/> values.
374
internal static
JsonNode
? ConvertFromValue<T>(T? value, JsonNodeOptions? options = null)
381
if (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>
15
public 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>
22
public 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>
29
public 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>
36
public 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>
43
public 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>
50
public 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>
57
public 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>
64
public 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>
71
public 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>
78
public 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>
85
public 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>
92
public 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>
99
public 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>
106
public 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>
113
public 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>
120
public 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>
127
public 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>
134
public 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>
141
public 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>
148
public 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>
155
public 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>
162
public 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>
170
public 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>
178
public 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>
185
public 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>
192
public 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>
200
public 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>
208
public 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>
216
public 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>
224
public 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>
232
public 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>
240
public 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>
248
public 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>
255
public 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>
262
public 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>
269
public 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>
276
public 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>
283
public 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>
290
public 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>
297
public 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>
304
public 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>
311
public 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>
318
public 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>
325
public 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>
332
public 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>
339
public 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>
346
public 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>
353
public 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>
360
public 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>
367
public 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>
374
public 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>
381
public 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>
388
public 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>
395
public 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>
402
public 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>
410
public 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>
418
public 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>
425
public 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>
432
public 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>
439
public 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>
447
public 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>
455
public 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>
463
public 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>
471
public 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>
479
public 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>
487
public 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.
47
public static
JsonNode
? Parse(
62
/// A <see cref="
JsonNode
"/> representation of the JSON value.
70
public static
JsonNode
? Parse(
88
/// A <see cref="
JsonNode
"/> representation of the JSON value.
93
public static
JsonNode
? Parse(
104
/// <see cref="
JsonNode
"/>. The Stream will be read to completion.
110
/// A <see cref="
JsonNode
"/> representation of the JSON value.
115
public 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.
140
public 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)
36
public JsonObject(IEnumerable<KeyValuePair<string,
JsonNode
?>> properties, JsonNodeOptions? options = null) : this(options)
38
int capacity = properties is ICollection<KeyValuePair<string,
JsonNode
?>> propertiesCollection ? propertiesCollection.Count : 0;
39
OrderedDictionary<string,
JsonNode
?> dictionary = CreateDictionary(options, capacity);
41
foreach (KeyValuePair<string,
JsonNode
?> node in properties)
78
private OrderedDictionary<string,
JsonNode
?> Dictionary => _dictionary ?? InitializeDictionary();
80
private protected override
JsonNode
? GetItem(int index) => GetAt(index).Value;
81
private protected override void SetItem(int index,
JsonNode
? value) => SetAt(index, value);
83
internal override
JsonNode
DeepCloneCore()
85
GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement);
99
foreach (KeyValuePair<string,
JsonNode
?> item in dictionary)
107
internal string GetPropertyName(
JsonNode
? node)
109
KeyValuePair<string,
JsonNode
?>? item = FindValue(node);
124
public bool TryGetPropertyValue(string propertyName, out
JsonNode
? jsonNode) => TryGetPropertyValue(propertyName, out jsonNode, out _);
141
public bool TryGetPropertyValue(string propertyName, out
JsonNode
? jsonNode, out int index)
165
GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement);
187
GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement);
199
foreach (KeyValuePair<string,
JsonNode
?> entry in Dictionary)
217
internal override bool DeepEqualsCore(
JsonNode
node)
227
OrderedDictionary<string,
JsonNode
?> currentDict = Dictionary;
228
OrderedDictionary<string,
JsonNode
?> otherDict = jsonObject.Dictionary;
235
foreach (KeyValuePair<string,
JsonNode
?> item in currentDict)
237
if (!otherDict.TryGetValue(item.Key, out
JsonNode
? jsonNode) || !DeepEquals(item.Value, jsonNode))
250
internal
JsonNode
? GetItem(string propertyName)
254
if (TryGetPropertyValue(propertyName, out
JsonNode
? value))
263
internal override void GetPath(ref ValueStringBuilder path,
JsonNode
? child)
284
internal void SetItem(string propertyName,
JsonNode
? value)
288
OrderedDictionary<string,
JsonNode
?> dict = Dictionary;
302
JsonNode
? replacedValue = dict.GetAt(index).Value;
316
private void DetachParent(
JsonNode
? item)
323
private KeyValuePair<string,
JsonNode
?>? FindValue(
JsonNode
? value)
325
foreach (KeyValuePair<string,
JsonNode
?> item in Dictionary)
358
foreach (KeyValuePair<string,
JsonNode
?> item in _node)
373
public
JsonNode
? Value;
System\Text\Json\Nodes\JsonObject.IDictionary.cs (31)
13
private OrderedDictionary<string,
JsonNode
?>? _dictionary;
26
public void Add(string propertyName,
JsonNode
? value)
43
public bool TryAdd(string propertyName,
JsonNode
? value) => TryAdd(propertyName, value, out _);
55
public bool TryAdd(string propertyName,
JsonNode
? value, out int index)
86
public void Add(KeyValuePair<string,
JsonNode
?> property) => Add(property.Key, property.Value);
93
OrderedDictionary<string,
JsonNode
?>? dictionary = _dictionary;
101
foreach (
JsonNode
? node in dictionary.Values)
145
bool success = Dictionary.Remove(propertyName, out
JsonNode
? removedNode);
155
/// Determines whether the <see cref="JsonObject"/> contains a specific property name and <see cref="
JsonNode
"/> reference.
161
bool ICollection<KeyValuePair<string,
JsonNode
?>>.Contains(KeyValuePair<string,
JsonNode
?> item) =>
162
((IDictionary<string,
JsonNode
?>)Dictionary).Contains(item);
181
void ICollection<KeyValuePair<string,
JsonNode
?>>.CopyTo(KeyValuePair<string,
JsonNode
?>[] array, int index) =>
182
((IDictionary<string,
JsonNode
?>)Dictionary).CopyTo(array, index);
190
public IEnumerator<KeyValuePair<string,
JsonNode
?>> GetEnumerator() => Dictionary.GetEnumerator();
201
bool ICollection<KeyValuePair<string,
JsonNode
?>>.Remove(KeyValuePair<string,
JsonNode
?> item) => Remove(item.Key);
206
ICollection<string> IDictionary<string,
JsonNode
?>.Keys => Dictionary.Keys;
211
ICollection<
JsonNode
?> IDictionary<string,
JsonNode
?>.Values => Dictionary.Values;
227
bool IDictionary<string,
JsonNode
?>.TryGetValue(string propertyName, out
JsonNode
? jsonNode)
237
bool ICollection<KeyValuePair<string,
JsonNode
?>>.IsReadOnly => false;
247
private OrderedDictionary<string,
JsonNode
?> InitializeDictionary()
249
GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement);
253
OrderedDictionary<string,
JsonNode
?> newDictionary = CreateDictionary(Options);
259
JsonNode
? node = JsonNodeConverter.Create(jElementProperty.Value, Options);
267
OrderedDictionary<string,
JsonNode
?>? exchangedDictionary = Interlocked.CompareExchange(ref _dictionary, newDictionary, null);
285
private static OrderedDictionary<string,
JsonNode
?> CreateDictionary(JsonNodeOptions? options, int capacity = 0)
298
private void GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement)
System\Text\Json\Nodes\JsonObject.IList.cs (17)
15
public KeyValuePair<string,
JsonNode
?> GetAt(int index) => Dictionary.GetAt(index);
24
public void SetAt(int index, string propertyName,
JsonNode
? value)
28
OrderedDictionary<string,
JsonNode
?> dictionary = Dictionary;
29
KeyValuePair<string,
JsonNode
?> existing = dictionary.GetAt(index);
40
public void SetAt(int index,
JsonNode
? value)
42
OrderedDictionary<string,
JsonNode
?> dictionary = Dictionary;
43
KeyValuePair<string,
JsonNode
?> existing = dictionary.GetAt(index);
67
public void Insert(int index, string propertyName,
JsonNode
? value)
80
KeyValuePair<string,
JsonNode
?> existing = Dictionary.GetAt(index);
86
KeyValuePair<string,
JsonNode
?> IList<KeyValuePair<string,
JsonNode
?>>.this[int index]
93
int IList<KeyValuePair<string,
JsonNode
?>>.IndexOf(KeyValuePair<string,
JsonNode
?> item) => ((IList<KeyValuePair<string,
JsonNode
?>>)Dictionary).IndexOf(item);
96
void IList<KeyValuePair<string,
JsonNode
?>>.Insert(int index, KeyValuePair<string,
JsonNode
?> item) => Insert(index, item.Key, item.Value);
99
void IList<KeyValuePair<string,
JsonNode
?>>.RemoveAt(int index) => RemoveAt(index);
System\Text\Json\Nodes\JsonValue.cs (6)
32
/// <seealso cref="
JsonNode
.GetValue{T}"></seealso>
57
if (value is
JsonNode
)
91
if (value is
JsonNode
)
106
internal override bool DeepEqualsCore(
JsonNode
otherNode)
126
static JsonElement ToJsonElement(
JsonNode
node, out JsonDocument? backingDocument)
154
internal sealed override void GetPath(ref ValueStringBuilder path,
JsonNode
? child)
System\Text\Json\Nodes\JsonValueOfElement.cs (2)
20
internal override
JsonNode
DeepCloneCore() => new JsonValueOfElement(Value.Clone(), Options);
23
internal override bool DeepEqualsCore(
JsonNode
otherNode)
System\Text\Json\Nodes\JsonValueOfJsonPrimitive.cs (3)
46
internal override
JsonNode
DeepCloneCore() => new JsonValueOfJsonString(_value, Options);
137
internal override
JsonNode
DeepCloneCore() => new JsonValueOfJsonBool(_value, Options);
184
internal override
JsonNode
DeepCloneCore() => new JsonValueOfJsonNumber(_value, Options);
System\Text\Json\Nodes\JsonValueOfT.cs (1)
19
Debug.Assert(value is not
JsonNode
);
System\Text\Json\Nodes\JsonValueOfTCustomized.cs (1)
27
internal override
JsonNode
DeepCloneCore() => JsonSerializer.SerializeToNode(Value, _jsonTypeInfo)!;
System\Text\Json\Nodes\JsonValueOfTPrimitive.cs (2)
28
internal override
JsonNode
DeepCloneCore() => new JsonValuePrimitive<TValue>(Value, _converter, Options);
30
internal override bool DeepEqualsCore(
JsonNode
otherNode)
System\Text\Json\Schema\JsonSchema.cs (14)
62
public
JsonNode
? Constant { get => _constant; set { VerifyMutable(); _constant = value; } }
63
private
JsonNode
? _constant;
89
public
JsonNode
? DefaultValue { get => _defaultValue; set { VerifyMutable(); _defaultValue = value; } }
90
private
JsonNode
? _defaultValue;
151
public
JsonNode
ToJsonNode(JsonSchemaExporterOptions options)
155
return CompleteSchema((
JsonNode
)boolSchema);
170
if (MapSchemaType(Type) is
JsonNode
type)
206
requiredArray.Add((
JsonNode
)requiredProperty);
250
objSchema.Add(MinLengthPropertyName, (
JsonNode
)minLength);
255
objSchema.Add(MaxLengthPropertyName, (
JsonNode
)maxLength);
260
JsonNode
CompleteSchema(
JsonNode
schema)
312
public static
JsonNode
? MapSchemaType(JsonSchemaType schemaType)
329
array.Add((
JsonNode
)ToIdentifier(type)!);
System\Text\Json\Schema\JsonSchemaExporter.cs (7)
21
/// Gets the JSON schema for <paramref name="type"/> as a <see cref="
JsonNode
"/> document.
27
public static
JsonNode
GetJsonSchemaAsNode(this JsonSerializerOptions options, Type type, JsonSchemaExporterOptions? exporterOptions = null)
38
/// Gets the JSON schema for <paramref name="typeInfo"/> as a <see cref="
JsonNode
"/> document.
43
public static
JsonNode
GetJsonSchemaAsNode(this JsonTypeInfo typeInfo, JsonSchemaExporterOptions? exporterOptions = null)
114
JsonNode
discriminatorNode = discriminatorValue switch
116
string stringId => (
JsonNode
)stringId,
117
_ => (
JsonNode
)(int)discriminatorValue,
System\Text\Json\Schema\JsonSchemaExporterOptions.cs (2)
31
public 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)
57
JsonNode
? item = JsonNodeConverter.ReadAsJsonNode(ref reader, options);
System\Text\Json\Serialization\Converters\Node\JsonNodeConverter.cs (7)
14
internal sealed class JsonNodeConverter : JsonConverter<
JsonNode
?>
18
public override void Write(Utf8JsonWriter writer,
JsonNode
? value, JsonSerializerOptions options)
30
public override
JsonNode
? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
37
internal static
JsonNode
? ReadAsJsonElement(ref Utf8JsonReader reader, JsonNodeOptions options)
58
internal static
JsonNode
? ReadAsJsonNode(ref Utf8JsonReader reader, JsonNodeOptions options)
79
public static
JsonNode
? Create(JsonElement element, JsonNodeOptions? options)
81
JsonNode
? node;
System\Text\Json\Serialization\Converters\Node\JsonNodeConverterFactory.cs (2)
33
Debug.Assert(typeof(
JsonNode
) == typeToConvert);
37
public override bool CanConvert(Type typeToConvert) => typeof(
JsonNode
).IsAssignableFrom(typeToConvert);
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (5)
25
bool success = JsonNodeConverter.Instance.TryRead(ref reader, typeof(
JsonNode
), options, ref state, out
JsonNode
? value, out _);
31
Debug.Assert(value == null || value is
JsonNode
);
32
JsonNode
? jNodeValue = value;
104
JsonNode
? value = JsonNodeConverter.ReadAsJsonNode(ref reader, options);
System\Text\Json\Serialization\Converters\Object\ObjectConverter.cs (1)
132
JsonNode
? node = JsonNodeConverter.Instance.Read(ref reader, typeToConvert, options);
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (1)
505
enumValues.Add((
JsonNode
)fieldInfo.JsonName);
System\Text\Json\Serialization\Converters\Value\JsonPrimitiveConverter.cs (3)
60
new JsonSchema { Enum = [(
JsonNode
)"NaN", (
JsonNode
)"Infinity", (
JsonNode
)"-Infinity"] },
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (3)
462
JsonNode
? jsonNode,
471
foreach (KeyValuePair<string,
JsonNode
?> property in jsonObject)
509
static string ReadAsStringMetadataValue(
JsonNode
? jsonNode)
System\Text\Json\Serialization\JsonSerializer.Read.HandlePropertyName.cs (1)
134
genericArgs[1].UnderlyingSystemType == typeof(Nodes.
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>
30
public 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>
52
public 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>
73
public 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>
90
public 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>
130
public static object? Deserialize(this
JsonNode
? node, Type returnType, JsonSerializerContext context)
139
private static TValue? ReadFromNode<TValue>(
JsonNode
? node, JsonTypeInfo<TValue> jsonTypeInfo)
160
private 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>
27
public 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>
52
public 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>
69
public 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>
89
public 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>
115
public static
JsonNode
? SerializeToNode(object? value, Type inputType, JsonSerializerContext context)
124
private static
JsonNode
? WriteNode<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
134
return
JsonNode
.Parse(output.WrittenSpan, options.GetNodeOptions(), options.GetDocumentOptions());
142
private static
JsonNode
? WriteNodeAsObject(object? value, JsonTypeInfo jsonTypeInfo)
152
return
JsonNode
.Parse(output.WrittenSpan, options.GetNodeOptions(), options.GetDocumentOptions());
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
147
/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="
JsonNode
"/> values.
150
public static JsonConverter<
JsonNode
?> JsonNodeConverter => s_jsonNodeConverter ??= new JsonNodeConverter();
151
private static JsonConverter<
JsonNode
?>? s_jsonNodeConverter;