7 types derived from JsonNode
System.Text.Json (7)
System\Text\Json\Nodes\JsonArray.cs (1)
21public sealed partial class JsonArray : JsonNode
System\Text\Json\Nodes\JsonArray.IList.cs (2)
9public sealed partial class JsonArray : JsonNode, IList<JsonNode?>
System\Text\Json\Nodes\JsonObject.cs (1)
19public sealed partial class JsonObject : JsonNode
System\Text\Json\Nodes\JsonObject.IDictionary.cs (1)
11public partial class JsonObject : IDictionary<string, JsonNode?>
System\Text\Json\Nodes\JsonObject.IList.cs (1)
9public partial class JsonObject : IList<KeyValuePair<string, JsonNode?>>
System\Text\Json\Nodes\JsonValue.cs (1)
14public abstract partial class JsonValue : JsonNode
1195 references to JsonNode
aspire (5)
Configuration\ConfigurationService.cs (3)
23settings = JsonNode.Parse(existingContent)?.AsObject() ?? new JsonObject(); 57var settings = JsonNode.Parse(existingContent)?.AsObject(); 131var settings = JsonNode.Parse(content)?.AsObject();
Projects\FallbackProjectParser.cs (2)
133packageRefArray.Add((JsonNode?)packageObj); 144projectRefArray.Add((JsonNode?)projectObj);
Aspire.Cli.Tests (5)
Commands\ConfigCommandTests.cs (5)
74var settings = JsonNode.Parse(json)?.AsObject(); 97var settings = JsonNode.Parse(json)?.AsObject(); 122var settings = JsonNode.Parse(json)?.AsObject(); 154var settings = JsonNode.Parse(json)?.AsObject(); 274var settings = JsonNode.Parse(json)?.AsObject();
Aspire.Components.Common.TestUtilities (4)
ConformanceTests.cs (4)
343var config = JsonNode.Parse(ValidJsonConfig); 357var config = JsonNode.Parse(json);
Aspire.Dashboard (42)
GenAIEventsContext.GetJsonTypeInfo.g.cs (1)
50if (type == typeof(global::System.Text.Json.Nodes.JsonNode))
GenAIEventsContext.JsonNode.g.cs (8)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>? _JsonNode; 18public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> JsonNode 20get => _JsonNode ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.JsonNode)); 23private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> Create_JsonNode(global::System.Text.Json.JsonSerializerOptions options) 25if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.JsonNode>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> jsonTypeInfo)) 27jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.JsonNode>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonNodeConverter);
GenAIEventsContext.ToolCallFunction.g.cs (3)
67var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.Nodes.JsonNode> 84properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.Nodes.JsonNode>(options, info1); 106global::System.Text.Json.Nodes.JsonNode __value_Arguments = ((global::Aspire.Dashboard.Model.GenAI.ToolCallFunction)value).Arguments;
GenAIEventsContext.ToolEvent.g.cs (3)
67var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.Nodes.JsonNode> 84properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.Nodes.JsonNode>(options, info1); 106global::System.Text.Json.Nodes.JsonNode __value_Content = ((global::Aspire.Dashboard.Model.GenAI.ToolEvent)value).Content;
GenAIMessagesContext.GetJsonTypeInfo.g.cs (1)
62if (type == typeof(global::System.Text.Json.Nodes.JsonNode))
GenAIMessagesContext.JsonNode.g.cs (8)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>? _JsonNode; 18public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> JsonNode 20get => _JsonNode ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.JsonNode)); 23private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> Create_JsonNode(global::System.Text.Json.JsonSerializerOptions options) 25if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.JsonNode>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> jsonTypeInfo)) 27jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.JsonNode>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonNodeConverter);
GenAIMessagesContext.ToolCallRequestPart.g.cs (3)
86var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.Nodes.JsonNode> 103properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.Nodes.JsonNode>(options, info2); 149global::System.Text.Json.Nodes.JsonNode __value_Arguments = ((global::Aspire.Dashboard.Model.GenAI.ToolCallRequestPart)value).Arguments;
GenAIMessagesContext.ToolCallResponsePart.g.cs (3)
67var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.Nodes.JsonNode> 84properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.Nodes.JsonNode>(options, info1); 125global::System.Text.Json.Nodes.JsonNode __value_Response = ((global::Aspire.Dashboard.Model.GenAI.ToolCallResponsePart)value).Response;
Model\GenAI\GenAIEvents.cs (2)
24public JsonNode? Content { get; set; } 44public JsonNode? Arguments { get; set; }
Model\GenAI\GenAIItemPartViewModel.cs (1)
78jsonObject[kvp.Key] = JsonNode.Parse(kvp.Value.GetRawText());
Model\GenAI\GenAIMessages.cs (2)
48public JsonNode? Arguments { get; set; } 62public JsonNode? Response { get; set; } = default!;
Model\GenAI\GenAIVisualizerDialogViewModel.cs (6)
287var toolResponse = ProcessJsonPayload(toolEvent.Content); 324var args = ProcessJsonPayload(function.Arguments); 351private static JsonNode? ProcessJsonPayload(JsonNode? args) 357var node = JsonNode.Parse(argsJson);
Otlp\Model\OtlpHelpers.cs (1)
121private static JsonNode? ConvertAnyValue(AnyValue value)
Aspire.Dashboard.Components.Tests (2)
Controls\GenAIVisualizerDialogTests.cs (2)
77Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments = JsonNode.Parse(@"{""count"":2}") }] 82Parts = [new ToolCallResponsePart { Response = JsonNode.Parse(@"[""Jack"",""Jane""]") }]
Aspire.Dashboard.Tests (16)
Integration\McpServiceTests.cs (10)
41var jsonResponse = JsonNode.Parse(responseData!)!; 115var jsonResponse = JsonNode.Parse(responseData!)!; 139var jsonResponse = JsonNode.Parse(responseData!)!; 175var jsonResponse = JsonNode.Parse(responseData!)!; 235var jsonResponse = JsonNode.Parse(responseData!)!;
Integration\StartupTests.cs (2)
426var jsonResponse = JsonNode.Parse(responseData!)!;
Model\GenAIVisualizerDialogViewModelTests.cs (4)
330Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments = JsonNode.Parse(@"{""count"":2}") }] 335Parts = [new ToolCallResponsePart { Response = JsonNode.Parse(@"[""Jack"",""Jane""]") }] 453Parts = [new ToolCallRequestPart { Name = "generate_names", Arguments = JsonNode.Parse(@"{""count"":2}") }] 458Parts = [new ToolCallResponsePart { Response = JsonNode.Parse(@"[""Jack"",""Jane""]") }]
Aspire.Hosting (11)
Dashboard\DashboardEventHandlers.cs (4)
146var configJson = JsonNode.Parse(configText)?.AsObject(); 159foreach (var framework in frameworks) 238var configJson = JsonNode.Parse(originalConfigText)?.AsObject(); 252foreach (var framework in frameworks)
Dcp\DcpExecutor.cs (2)
1999var current = JsonSerializer.SerializeToNode(obj); 2004var changed = JsonSerializer.SerializeToNode(copy);
Devcontainers\DevcontainerSettingsWriter.cs (2)
123if (!settings.TryGetPropertyValue(PortAttributesFieldName, out var portsAttributesNode)) 167if (!portsAttributes.TryGetPropertyValue(port, out var portAttributeNode))
Publishing\Internal\DeploymentStateManagerBase.cs (3)
95if (!current.TryGetPropertyValue(key, out var existing) || existing is not JsonObject) 171var flattenedState = JsonNode.Parse(fileContent, documentOptions: jsonDocumentOptions)!.AsObject(); 226var sectionData = _state?.TryGetPropertyValue(sectionName, out var sectionNode) == true && sectionNode is JsonObject obj
Aspire.Hosting.Azure (12)
AzureBicepResource.cs (3)
214if (inputValue is JsonNode || inputValue is IEnumerable<string>) 350if (JsonNode.Parse(responseContent) is JsonObject responseObj) 393foreach (var detail in detailsArray)
AzureBicepResourceExtensions.cs (1)
179public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, JsonNode value)
Provisioning\BicepUtilities.cs (3)
37JsonNode node => node, 98var parameters = JsonNode.Parse(jsonString)?.AsObject(); 100? JsonNode.Parse(scopeString)?.AsObject()
Provisioning\JsonExtensions.cs (3)
10public static JsonNode Prop(this JsonNode obj, string key) 15var node = jsonObj[key];
Provisioning\Provisioners\BicepProvisioner.cs (2)
51JsonNode? outputObj = null; 54outputObj = JsonNode.Parse(outputJson);
Aspire.Hosting.Azure.EventHubs (5)
AzureEventHubsExtensions.cs (3)
290var tempConfig = JsonNode.Parse(CreateEmulatorConfigJson(builder.Resource)); 404public static IResourceBuilder<AzureEventHubsEmulatorResource> WithConfiguration(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, Action<JsonNode> configJson)
ConfigJsonAnnotation.cs (2)
14public ConfigJsonAnnotation(Action<JsonNode> configure) 19public Action<JsonNode> Configure { get; }
Aspire.Hosting.Azure.ServiceBus (5)
AzureServiceBusExtensions.cs (3)
427var tempConfig = JsonNode.Parse(CreateEmulatorConfigJson(builder.Resource)); 502public static IResourceBuilder<AzureServiceBusEmulatorResource> WithConfiguration(this IResourceBuilder<AzureServiceBusEmulatorResource> builder, Action<JsonNode> configJson)
ConfigJsonAnnotation.cs (2)
14public ConfigJsonAnnotation(Action<JsonNode> configure) 19public Action<JsonNode> Configure { get; }
Aspire.Hosting.Azure.Tests (41)
AzureAppServiceTests.cs (1)
809private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureBicepResourceTests.cs (1)
193var manifest = await ManifestUtils.GetManifest(bicepResource.Resource);
AzureContainerAppsTests.cs (1)
1515private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureDeployerTests.cs (4)
1010var stateJson = JsonNode.Parse(stateContent); 1132var stateJson = JsonNode.Parse(stateContent);
AzureFunctionsTests.cs (1)
423private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureInfrastructureExtensionsTests.cs (3)
27var manifest = await ManifestUtils.GetManifest(infrastructure1.Resource); 52var manifest = await ManifestUtils.GetManifest(infrastructure1.Resource); 91var manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
AzureManifestUtils.cs (5)
15public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource, bool skipPreparer = false) => 18public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource) => 21private static async Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource, bool skipPreparer) 31var manifestNode = await ManifestUtils.GetManifest(resource, manifestDir); 33if (!manifestNode.AsObject().TryGetPropertyValue("path", out var pathNode))
AzurePostgresExtensionsTests.cs (1)
492var manifest = await ManifestUtils.GetManifest(postgres.Resource);
AzureStorageExtensionsTests.cs (12)
488var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 503var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 518var tableManifest = await ManifestUtils.GetManifest(table.Resource); 573var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 588var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 603var tableManifest = await ManifestUtils.GetManifest(table.Resource); 711var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 724var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 737var tableManifest = await ManifestUtils.GetManifest(table.Resource); 793var blobManifest = await ManifestUtils.GetManifest(blob.Resource); 808var queueManifest = await ManifestUtils.GetManifest(queue.Resource); 823var tableManifest = await ManifestUtils.GetManifest(table.Resource);
JsonExtensionsTests.cs (4)
15var azureNode = rootJson.Prop("Azure"); 19var retrievedNode = rootJson.Prop("Azure"); 33var newNode = rootJson.Prop("NewProperty"); 47var deeply = rootJson.Prop("Level1")
ProvisioningContextTests.cs (2)
191var parsed = JsonNode.Parse(result);
ProvisioningTestHelpers.cs (1)
604var sectionData = _state.TryGetPropertyValue(sectionName, out var node) && node is JsonObject obj
PublicApiTests\EventHubsPublicApiTests.cs (2)
359Action<JsonNode> configJson = (_) => { }; 372Action<JsonNode> configJson = null!;
PublicApiTests\ServiceBusPublicApiTests.cs (2)
291Action<JsonNode> configJson = (_) => { }; 304Action<JsonNode> configJson = null!;
RoleAssignmentTests.cs (1)
256private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
Aspire.Hosting.Containers.Tests (10)
ContainerResourceTests.cs (5)
143var manifest = await ManifestUtils.GetManifest(c2.Resource); 182var manifest = await ManifestUtils.GetManifest(containerResource); 216var manifest = await ManifestUtils.GetManifest(containerResource); 263var manifest = await ManifestUtils.GetManifest(containerResource); 312var manifest = await ManifestUtils.GetManifest(containerResource, manifestDirectory: appHostPath);
WithDockerfileTests.cs (5)
276var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 323var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 369var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 414var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath); 853var manifest = await ManifestUtils.GetManifest(container.Resource, manifestDirectory: tempContextPath);
Aspire.Hosting.Garnet.Tests (3)
AddGarnetTests.cs (3)
93var manifest = await ManifestUtils.GetManifest(garnet.Resource); 133var manifest = await ManifestUtils.GetManifest(garnet.Resource); 169var manifest = await ManifestUtils.GetManifest(garnet.Resource);
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
80var manifest = await ManifestUtils.GetManifest(kafka.Resource);
Aspire.Hosting.Keycloak.Tests (1)
KeycloakResourceBuilderTests.cs (1)
114var manifest = await ManifestUtils.GetManifest(keycloak.Resource);
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
132var serverManifest = await ManifestUtils.GetManifest(milvus.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes 133var dbManifest = await ManifestUtils.GetManifest(db1.Resource);
Aspire.Hosting.MongoDB.Tests (2)
AddMongoDBTests.cs (2)
199var mongoManifest = await ManifestUtils.GetManifest(mongo.Resource); 200var dbManifest = await ManifestUtils.GetManifest(db.Resource);
Aspire.Hosting.MySql.Tests (3)
AddMySqlTests.cs (3)
159var mySqlManifest = await ManifestUtils.GetManifest(mysql.Resource); 160var dbManifest = await ManifestUtils.GetManifest(db.Resource); 198var serverManifest = await ManifestUtils.GetManifest(mysql.Resource);
Aspire.Hosting.Nats.Tests (2)
AddNatsTests.cs (2)
193var manifest = await ManifestUtils.GetManifest(nats.Resource); 230var manifest = await ManifestUtils.GetManifest(nats.Resource);
Aspire.Hosting.NodeJs.Tests (9)
AddNodeAppTests.cs (1)
23var manifest = await ManifestUtils.GetManifest(nodeApp.Resource);
AddViteAppTests.cs (8)
29var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path); 93var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path); 113var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path); 133var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path); 158var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path); 176var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path); 200var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path); 218var manifest = await ManifestUtils.GetManifest(nodeApp.Resource, tempDir.Path);
Aspire.Hosting.Oracle.Tests (3)
AddOracleTests.cs (3)
199var serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource); 200var dbManifest = await ManifestUtils.GetManifest(db.Resource); 238var serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
Aspire.Hosting.PostgreSQL.Tests (3)
AddPostgresTests.cs (3)
250var serverManifest = await ManifestUtils.GetManifest(pgServer.Resource); 251var dbManifest = await ManifestUtils.GetManifest(db.Resource); 294var serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
Aspire.Hosting.Python.Tests (2)
AddPythonAppTests.cs (2)
37var manifest = await ManifestUtils.GetManifest(pyproj.Resource, manifestDirectory: projectDirectory); 75var manifest = await ManifestUtils.GetManifest(pyproj.Resource, manifestDirectory: projectDirectory);
Aspire.Hosting.Qdrant.Tests (2)
AddQdrantTests.cs (2)
206var serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes 244var serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
Aspire.Hosting.RabbitMQ.Tests (2)
AddRabbitMQTests.cs (2)
207var manifest = await ManifestUtils.GetManifest(rabbit.Resource); 252var manifest = await ManifestUtils.GetManifest(rabbit.Resource);
Aspire.Hosting.Redis.Tests (7)
AddRedisTests.cs (4)
135var manifest = await ManifestUtils.GetManifest(redis.Resource); 169var manifest = await ManifestUtils.GetManifest(redis.Resource); 204var manifest = await ManifestUtils.GetManifest(redis.Resource); 239var manifest = await ManifestUtils.GetManifest(redis.Resource);
RedisFunctionalTests.cs (3)
560var jo = JsonNode.Parse(content); 562var agreements = jo["agreements"];
Aspire.Hosting.Seq.Tests (3)
AddSeqTests.cs (3)
92var manifest = await ManifestUtils.GetManifest(seq.Resource); 253var manifest = await ManifestUtils.GetManifest(seq.Resource); 283var manifest = await ManifestUtils.GetManifest(seq.Resource);
Aspire.Hosting.SqlServer.Tests (3)
AddSqlServerTests.cs (3)
129var serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource); 130var dbManifest = await ManifestUtils.GetManifest(db.Resource); 170var serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
Aspire.Hosting.Tests (47)
AddConnectionStringTests.cs (1)
30var connectionStringManifest = await ManifestUtils.GetManifest(connectionStringResource).DefaultTimeout();
AddParameterTests.cs (5)
102var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 154var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 224var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 281var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "val")).DefaultTimeout(); 309var connectionStringManifest = await ManifestUtils.GetManifest(connectionStringResource).DefaultTimeout();
Dashboard\DashboardResourceTests.cs (1)
610var manifest = await ManifestUtils.GetManifestOrNull(dashboard).DefaultTimeout();
ExecutableResourceTests.cs (1)
67var manifest = await ManifestUtils.GetManifest(exe2.Resource).DefaultTimeout();
ExternalServiceTests.cs (1)
448var manifest = await ManifestUtils.GetManifest(project.Resource);
KestrelConfigTests.cs (4)
176var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 220var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 291var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 313var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
ManifestGenerationTests.cs (2)
103var redisManifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout(); 552var manifest = await ManifestUtils.GetManifest(param.Resource).DefaultTimeout();
ProjectResourceTests.cs (2)
498var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout(); 548var manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
PublishAsConnectionStringTests.cs (1)
20var manifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout();
PublishAsDockerfileTests.cs (5)
28var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 74var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 123var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 172var manifest = await ManifestUtils.GetManifest(frontend.Resource, manifestDirectory: path).DefaultTimeout(); 232var manifest = await ManifestUtils.GetManifest(project.Resource, manifestDirectory: path).DefaultTimeout();
Schema\SchemaTests.cs (4)
797var manifestJson = JsonNode.Parse(manifestText); 810var manifestJson = JsonNode.Parse(manifestText);
Utils\ManifestUtils.cs (11)
13public static async Task<JsonNode> GetManifest(IResource resource, string? manifestDirectory = null) 15var node = await GetManifestOrNull(resource, manifestDirectory); 20public static async Task<JsonNode?> GetManifestOrNull(IResource resource, string? manifestDirectory = null) 39var obj = JsonNode.Parse(ms); 41var resourceNode = obj[resource.Name]; 45public static async Task<JsonNode[]> GetManifests(IResource[] resources) 56var results = new List<JsonNode>(); 65var obj = JsonNode.Parse(ms); 67var resourceNode = obj[r.Name];
WithEndpointTests.cs (9)
253var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 281var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 308var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 335var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 362var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 389var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 416var manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout(); 447var manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout(); 517var manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout();
Aspire.Hosting.Valkey.Tests (2)
AddValkeyTests.cs (2)
127var manifest = await ManifestUtils.GetManifest(valkey.Resource); 165var manifest = await ManifestUtils.GetManifest(valkey.Resource);
Aspire.Hosting.Yarp (3)
YarpJsonConfigGeneratorBuilder.cs (3)
84var jsonProxyConfig = jsonObject["ReverseProxy"] = new JsonObject(); 100var node = JsonSerializer.SerializeToNode(route, _serializerOptions); 114var node = JsonSerializer.SerializeToNode(cluster, _serializerOptions);
ConfigurationSchemaGenerator (15)
ConfigSchemaEmitter.cs (15)
119var backupTypeNode = currentNode["type"]; 174var existingValue = propertiesNode[pathSegment]; 240var backupTypeNode = currentNode["type"]; 284var backupPropertyNode = currentNode[property.ConfigurationKeyName]; 315var backupTypeNode = currentNode["type"]; 316var backupContainerNode = currentNode[containerName]; 334private static void RestoreBackup(JsonNode? backupNode, string name, JsonObject parentNode) 449var propertyNodeType = propertyNode["type"]; 718private static void ReplaceNodeWithKeyCasingChange(JsonObject jsonObject, string key, JsonNode value) 734private sealed class SchemaOrderJsonNodeConverter : JsonConverter<JsonNode> 738public override bool CanConvert(Type typeToConvert) => typeof(JsonNode).IsAssignableFrom(typeToConvert) && typeToConvert != typeof(JsonValue); 740public override void Write(Utf8JsonWriter writer, JsonNode? value, JsonSerializerOptions options) 747IEnumerable<KeyValuePair<string, JsonNode>> properties = 761foreach (var item in array) 776public override JsonNode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
ConfigurationSchemaGenerator.Tests (4)
GeneratorTests.cs (4)
1579var actualJson = JsonNode.Parse(actual)!; 1580var expectedJson = JsonNode.Parse(expected)!;
dotnet (1)
CliSchema.cs (1)
83var node = s_jsonSerializerOptions.GetJsonSchemaAsNode(typeof(RootCommandDetails), new JsonSchemaExporterOptions());
dotnet-MsiInstallation.Tests (2)
WorkloadSetTests.cs (2)
361var searchResultJson = JsonNode.Parse(searchVersionResult.StdOut);
dotnet-new.IntegrationTests (4)
PostActionTests.cs (4)
1128JsonNode? jsonContents = JsonNode.Parse(jsonFileContents); 1159JsonNode? jsonContents = JsonNode.Parse(jsonFileContents);
dotnet-user-jwts (1)
Helpers\SigningKeysHandler.cs (1)
85var toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
IdentitySample.PasskeyConformance (1)
Data\ServerPublicKeyCredentialOptionsResponse.cs (1)
22var optionsObject = JsonNode.Parse(value.OptionsJson)?.AsObject()
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (8)
UserJwtsTests.cs (8)
303Assert.True(secretsJson.TryGetPropertyValue("Foo", out var fooField)); 521var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray()); 524Assert.True(secretsJson.TryGetPropertyValue("Foo", out var fooField)); 549var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray()); 552Assert.True(secretsJson.TryGetPropertyValue("Foo", out var fooField)); 588var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray()); 631var signingKey1 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray()); 635var signingKey2 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme-2")].AsArray());
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
ProblemDetailsJsonConverterTest.cs (1)
123Assert.IsAssignableFrom<JsonNode>(kvp.Value!);
Microsoft.AspNetCore.Http.Microbenchmarks (3)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (3)
252internal static async Task VerifyResponseJsonNodeAsync(HttpContext httpContext, Action<JsonNode> check, int expectedStatusCode = 200, string expectedContentType = "application/json; charset=utf-8") 255var node = JsonNode.Parse(body);
Microsoft.AspNetCore.Identity.Test (30)
Passkeys\PasskeyHandlerAssertionTest.cs (14)
58credentialJson["id"] = JsonNode.Parse(jsonValue); 109credentialJson["type"] = JsonNode.Parse(jsonValue); 158credentialJson["response"] = JsonNode.Parse(jsonValue); 192assertionStateJson["challenge"] = JsonNode.Parse(jsonValue); 227credentialJson["response"]!["clientDataJSON"] = JsonNode.Parse(jsonValue); 277credentialJson["response"]!["authenticatorData"] = JsonNode.Parse(jsonValue); 344credentialJson["response"]!["signature"] = JsonNode.Parse(jsonValue); 410credentialJson["response"]!["userHandle"] = JsonNode.Parse(jsonValue); 478clientDataJson["type"] = JsonNode.Parse(jsonValue); 530clientDataJson["challenge"] = JsonNode.Parse(jsonValue); 613clientDataJson["origin"] = JsonNode.Parse(jsonValue); 667clientDataJson["tokenBinding"] = JsonNode.Parse(jsonValue); 682clientDataJson["tokenBinding"] = JsonNode.Parse("{}"); 698clientDataJson["tokenBinding"] = JsonNode.Parse("""
Passkeys\PasskeyHandlerAttestationTest.cs (15)
58credentialJson["id"] = JsonNode.Parse(jsonValue); 109credentialJson["type"] = JsonNode.Parse(jsonValue); 158credentialJson["response"] = JsonNode.Parse(jsonValue); 193attestationStateJson["userEntity"]!["id"] = JsonNode.Parse(jsonValue); 228attestationStateJson["userEntity"]!["name"] = JsonNode.Parse(jsonValue); 263attestationStateJson["userEntity"]!["displayName"] = JsonNode.Parse(jsonValue); 313attestationStateJson["challenge"] = JsonNode.Parse(jsonValue); 348credentialJson["response"]!["clientDataJSON"] = JsonNode.Parse(jsonValue); 398credentialJson["response"]!["attestationObject"] = JsonNode.Parse(jsonValue); 447clientDataJson["type"] = JsonNode.Parse(jsonValue); 499clientDataJson["challenge"] = JsonNode.Parse(jsonValue); 582clientDataJson["origin"] = JsonNode.Parse(jsonValue); 636clientDataJson["tokenBinding"] = JsonNode.Parse(jsonValue); 651clientDataJson["tokenBinding"] = JsonNode.Parse("{}"); 667clientDataJson["tokenBinding"] = JsonNode.Parse("""
Passkeys\PasskeyScenarioTest.cs (1)
115var jsonObject = JsonNode.Parse(value)?.AsObject()
Microsoft.AspNetCore.JsonPatch.SystemTextJson (8)
Helpers\GenericListOrJsonArrayUtilities.cs (2)
35array[index] = (JsonNode)value; 82array.Insert(index, (JsonNode)value);
Helpers\JsonUtilities.cs (3)
24if (a is JsonNode nodeA && b is JsonNode nodeB) 26return JsonNode.DeepEquals(nodeA, nodeB);
Internal\JsonObjectAdapter.cs (3)
37if (!obj.TryGetPropertyValue(segment, out var valueAsToken)) 98if (!obj.TryGetPropertyValue(segment, out var currentValue)) 129if (!obj.TryGetPropertyValue(segment, out var nextTargetToken))
Microsoft.AspNetCore.JsonPatch.SystemTextJson.Tests (1)
IntegrationTests\HeterogenousCollectionTests.cs (1)
25var circleJObject = JsonObject.Parse(@"{
Microsoft.AspNetCore.OpenApi (55)
Extensions\JsonNodeSchemaExtensions.cs (22)
58/// Note that this method targets <see cref="JsonNode"/> and not <see cref="OpenApiSchema"/> because it is 80/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 82internal static void ApplyValidationAttributes(this JsonNode schema, IEnumerable<Attribute> validationAttributes) 168/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 171internal static void ApplyDefaultValue(this JsonNode schema, object? defaultValue, JsonTypeInfo? jsonTypeInfo) 196/// Note that this method targets <see cref="JsonNode"/> and not <see cref="OpenApiSchema"/> because 200/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 203internal static void ApplyPrimitiveTypesAndFormats(this JsonNode schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId) 222/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 224internal static void ApplyRouteConstraints(this JsonNode schema, IEnumerable<IRouteConstraint> constraints) 298/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 301internal static void ApplyParameterInfo(this JsonNode schema, ApiParameterDescription parameterDescription, JsonTypeInfo? jsonTypeInfo) 375/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 378internal static void MapPolymorphismOptionsToDiscriminator(this JsonNode schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId) 415/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 418internal static void ApplySchemaReferenceId(this JsonNode schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId) 447/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 449internal static void ApplyNullabilityContextInfo(this JsonNode schema, JsonPropertyInfo propertyInfo) 472/// <param name="schema">The <see cref="JsonNode"/> produced by the underlying schema generator.</param> 473internal static void PruneNullTypeForComponentizedTypes(this JsonNode schema) 492private static JsonSchemaType? MapJsonNodeToSchemaType(JsonNode? jsonNode) 508foreach (var node in jsonArray)
Extensions\OpenApiDocumentExtensions.cs (1)
38Examples = example is JsonNode exampleJson ? [exampleJson] : null,
OpenApiJsonSchemaContext.GetJsonTypeInfo.g.cs (1)
26if (type == typeof(global::System.Text.Json.Nodes.JsonNode))
OpenApiJsonSchemaContext.JsonNode.g.cs (8)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>? _JsonNode; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> JsonNode 22get => _JsonNode ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.JsonNode)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> Create_JsonNode(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.JsonNode>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonNode> jsonTypeInfo)) 29jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.JsonNode>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonNodeConverter);
Schemas\OpenApiJsonSchema.Helpers.cs (3)
87internal static JsonNode? ReadJsonNode(ref Utf8JsonReader reader) 90internal static JsonNode? ReadJsonNode(ref Utf8JsonReader reader, out JsonSchemaType? type) 211var enumValues = ReadList<JsonNode>(ref reader);
Schemas\OpenApiJsonSchemaContext.cs (1)
11[JsonSerializable(typeof(JsonNode))]
Services\Schemas\OpenApiSchemaService.cs (19)
217static JsonArray JsonArray(ReadOnlySpan<JsonNode> values) 221foreach (var value in values) 235var schemaAsJsonObject = CreateSchema(key); 469private JsonNode CreateSchema(OpenApiSchemaKey key) 471var schema = JsonSchemaExporter.GetJsonSchemaAsNode(_jsonSerializerOptions, key.Type, _configuration); 475private static JsonNode ResolveReferences(JsonNode node, JsonNode rootSchema) 480private static JsonNode ResolveReferencesRecursive(JsonNode node, JsonNode rootSchema) 484if (jsonObject.TryGetPropertyValue(OpenApiConstants.RefKeyword, out var refNode) && 493var resolvedNode = ResolveReference(refString, rootSchema); 515var processedValue = ResolveReferencesRecursive(property.Value, rootSchema); 532var processedValue = ResolveReferencesRecursive(jsonArray[i]!, rootSchema); 547private static JsonNode? ResolveReference(string refPath, JsonNode rootSchema) 566var current = rootSchema; 573if (currentObject.TryGetPropertyValue(segment, out var nextNode) && nextNode != null)
Microsoft.AspNetCore.OpenApi.Tests (30)
Integration\OpenApiDocumentIntegrationTests.cs (8)
80var documentNode = JsonNode.Parse(json); 111JsonNode document) : OpenApiVisitorBase 158var parent = Find(PathString, document); 159var @ref = parent[OpenApiSchemaKeywords.RefKeyword]; 178static bool IsValidSchemaReference(string id, JsonNode baseNode) 181static JsonNode Find(string id, JsonNode baseNode)
Services\OpenApiSchemaService\OpenApiSchemaService.ParameterSchemas.cs (20)
159[(int id = 2) => { }, (JsonNode defaultValue) => Assert.Equal(2, defaultValue.GetValue<int>())], 160[(float id = 3f) => { }, (JsonNode defaultValue) => Assert.Equal(3, defaultValue.GetValue<int>())], 161[(string id = "test") => { }, (JsonNode defaultValue) => Assert.Equal("test", defaultValue.GetValue<string>())], 162[(bool id = true) => { }, (JsonNode defaultValue) => Assert.True(defaultValue.GetValue<bool>())], 163[(TaskStatus status = TaskStatus.Canceled) => { }, (JsonNode defaultValue) => Assert.Equal(6, defaultValue.GetValue<int>())], 165[(Status status = Status.Pending) => { }, (JsonNode defaultValue) => Assert.Equal("Pending", defaultValue.GetValue<string>())], 166[([DefaultValue(2)] int id) => { }, (JsonNode defaultValue) => Assert.Equal(2, defaultValue.GetValue<int>())], 167[([DefaultValue(3f)] float id) => { }, (JsonNode defaultValue) => Assert.Equal(3, defaultValue.GetValue<int>())], 168[([DefaultValue("test")] string id) => { }, (JsonNode defaultValue) => Assert.Equal("test", defaultValue.GetValue<string>())], 169[([DefaultValue(true)] bool id) => { }, (JsonNode defaultValue) => Assert.True(defaultValue.GetValue<bool>())], 170[([DefaultValue(TaskStatus.Canceled)] TaskStatus status) => { }, (JsonNode defaultValue) => Assert.Equal(6, defaultValue.GetValue<int>())], 171[([DefaultValue(Status.Pending)] Status status) => { }, (JsonNode defaultValue) => Assert.Equal("Pending", defaultValue.GetValue<string>())], 172[([DefaultValue(null)] int? id) => { }, (JsonNode defaultValue) => Assert.True(defaultValue is null)], 173[([DefaultValue(2)] int? id) => { }, (JsonNode defaultValue) => Assert.Equal(2, defaultValue.GetValue<int>())], 174[([DefaultValue(null)] string? id) => { }, (JsonNode defaultValue) => Assert.True(defaultValue is null)], 175[([DefaultValue("foo")] string? id) => { }, (JsonNode defaultValue) => Assert.Equal("foo", defaultValue.GetValue<string>())], 176[([DefaultValue(null)] TaskStatus? status) => { }, (JsonNode defaultValue) => Assert.True(defaultValue is null)], 177[([DefaultValue(TaskStatus.Canceled)] TaskStatus? status) => { }, (JsonNode defaultValue) => Assert.Equal(6, defaultValue.GetValue<int>())], 182public async Task GetOpenApiParameters_HandlesRouteParametersWithDefaultValue(Delegate requestHandler, Action<JsonNode> assert) 195var openApiDefault = parameter.Schema!.Default;
Services\OpenApiSchemaService\OpenApiSchemaService.ResponseSchemas.cs (2)
990var defaultValue = Assert.IsAssignableFrom<JsonNode>(property.Value.Default);
Microsoft.Build.BuildCheck.UnitTests (3)
EndToEndTests.cs (3)
141KeyValuePair<string, JsonNode?> resource = output.DepsJsonResources.FirstOrDefault( 144resource.Equals(default(KeyValuePair<string, JsonNode?>)).ShouldBe(!isResourceExpected, 182JsonNode? depsJson = JsonObject.Parse(File.ReadAllText(depsFiles[0]));
Microsoft.Extensions.AI (1)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
220static JsonNode? JsonElementToJsonNode(JsonElement element) =>
Microsoft.Extensions.AI.Abstractions (91)
Functions\AIFunctionFactory.cs (7)
89/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided, 168/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <paramref name="serializerOptions"/> if provided, or else 259/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided, 345/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <paramref name="serializerOptions"/> if provided, or else 402/// <see cref="JsonDocument"/>, or <see cref="JsonNode"/>, it is deserialized directly. If the argument is anything else unknown, 449/// or <see cref="JsonNode"/>, it is deserialized into the parameter type, utilizing <see cref="AIFunctionFactoryOptions.SerializerOptions"/> if provided, 875JsonNode node => JsonSerializer.Deserialize(node, typeInfo),
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (15)
46/// <returns>A new <see cref="JsonNode"/> instance defining the JSON schema for <paramref name="type"/>.</returns> 50public static JsonNode GetJsonSchemaAsNode(this JsonSerializerOptions options, Type type, JsonSchemaExporterOptions? exporterOptions = null) 66/// <returns>A new <see cref="JsonNode"/> instance defining the JSON schema for <paramref name="typeInfo"/>.</returns> 70public static JsonNode GetJsonSchemaAsNode(this JsonTypeInfo typeInfo, JsonSchemaExporterOptions? exporterOptions = null) 80private static JsonNode MapRootTypeJsonSchema(JsonTypeInfo typeInfo, JsonSchemaExporterOptions exporterOptions) 153JsonNode discriminatorNode = discriminatorValue switch 155string stringId => (JsonNode)stringId, 156_ => (JsonNode)(int)discriminatorValue, 290JsonNode? defaultValue = null; 634[typeof(JsonNode)] = _ => JsonSchema.CreateTrueSchema(), 673new JsonSchema { Enum = new() { (JsonNode)"NaN", (JsonNode)"Infinity", (JsonNode)"-Infinity" } }, 708out JsonNode? defaultValue, 762enumValues.Add((JsonNode)effectiveName);
src\Shared\JsonSchemaExporter\JsonSchemaExporter.JsonSchema.cs (12)
116public JsonNode? Constant 206public JsonNode? DefaultValue 287public JsonNode ToJsonNode(JsonSchemaExporterOptions options) 291return CompleteSchema((JsonNode)boolSchema); 321if (MapSchemaType(Type) is JsonNode type) 357requiredArray.Add((JsonNode)requiredProperty); 401objSchema.Add(JsonSchemaConstants.MinLengthPropertyName, (JsonNode)minLength); 406objSchema.Add(JsonSchemaConstants.MaxLengthPropertyName, (JsonNode)maxLength); 411JsonNode CompleteSchema(JsonNode schema) 455private static JsonNode? MapSchemaType(JsonSchemaType schemaType) 472array.Add((JsonNode)ToIdentifier(type)!);
src\Shared\JsonSchemaExporter\JsonSchemaExporterOptions.cs (2)
35public Func<JsonSchemaExporterContext, JsonNode, JsonNode>? TransformSchemaNode { get; init; }
Utilities\AIJsonSchemaCreateOptions.cs (2)
24public Func<AIJsonSchemaCreateContext, JsonNode, JsonNode>? TransformSchemaNode { get; init; }
Utilities\AIJsonSchemaTransformOptions.cs (2)
17public Func<AIJsonSchemaTransformContext, JsonNode, JsonNode>? TransformSchemaNode { get; init; }
Utilities\AIJsonUtilities.cs (3)
134JsonNode? jsonNode = JsonSerializer.SerializeToNode(value, jti); 162static void NormalizeJsonNode(JsonNode? node) 167foreach (JsonNode? item in array)
Utilities\AIJsonUtilities.Defaults.cs (2)
84[JsonSerializable(typeof(JsonNode))] 168[JsonSerializable(typeof(JsonNode))]
Utilities\AIJsonUtilities.Schema.Create.cs (25)
112JsonNode parameterSchema = CreateJsonSchemaCore( 124(requiredProperties ??= []).Add((JsonNode)parameter.Name); 128JsonNode schema = new JsonObject(); 179JsonNode schema = CreateJsonSchemaCore(type, parameter: null, description, hasDefaultValue, defaultValue, serializerOptions, inferenceOptions); 207private static JsonNode CreateJsonSchemaCore( 232JsonNode? defaultValueNode = defaultValue is not null 260JsonNode TransformSchemaNode(JsonSchemaExporterContext schemaExporterContext, JsonNode schema) 273if (parameter?.Name is not null && objSchema.TryGetPropertyValue(RefPropertyName, out JsonNode? paramName)) 282objSchema[RefPropertyName] = (JsonNode)refUri; 309obj[TypePropertyName] = new JsonArray { (JsonNode)numericType, (JsonNode)"null" }; 313obj[TypePropertyName] = (JsonNode)numericType; 324if (objSchema.TryGetPropertyValue(TypePropertyName, out JsonNode? typeKeyWord) && 330objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 337objSchema.InsertAtStart(TypePropertyName, new JsonArray { (JsonNode)"string", (JsonNode)"null" }); 344JsonNode? defaultValueNode = JsonSerializer.SerializeToNode(defaultValue, ctx.TypeInfo); 351ConvertSchemaToObject(ref schema).InsertAtStart(DescriptionPropertyName, (JsonNode)localDescription); 357ConvertSchemaToObject(ref schema).InsertAtStart(SchemaPropertyName, (JsonNode)SchemaKeywordUri); 370static JsonObject ConvertSchemaToObject(ref JsonNode schema) 390void ApplyDataAnnotations(ref JsonNode schema, AIJsonSchemaCreateContext ctx) 706foreach (JsonNode? entry in typeArray) 741private static void InsertAtStart(this JsonObject jsonObject, string key, JsonNode value)
Utilities\AIJsonUtilities.Schema.Transform.cs (21)
32JsonNode? nodeSchema = JsonSerializer.SerializeToNode(schema, JsonContext.Default.JsonElement); 33JsonNode transformedSchema = TransformSchema(nodeSchema, transformOptions); 37private static JsonNode TransformSchema(JsonNode? schema, AIJsonSchemaTransformOptions transformOptions) 43private static JsonNode TransformSchemaCore(JsonNode? schema, AIJsonSchemaTransformOptions transformOptions, List<string>? path) 50schema = new JsonObject { [NotPropertyName] = (JsonNode)true }; 68if (schemaObj.TryGetPropertyValue(PropertiesPropertyName, out JsonNode? props) && props is JsonObject propsObj) 82if (schemaObj.TryGetPropertyValue(ItemsPropertyName, out JsonNode? itemsSchema)) 89if (schemaObj.TryGetPropertyValue(AdditionalPropertiesPropertyName, out JsonNode? additionalProps) && 97if (schemaObj.TryGetPropertyValue(NotPropertyName, out JsonNode? notSchema)) 108if (schemaObj.TryGetPropertyValue(combinatorKeyword, out JsonNode? combinatorSchema) && combinatorSchema is JsonArray combinatorArray) 114JsonNode element = TransformSchemaCore(combinatorArray[i], transformOptions, path); 130schemaObj[AdditionalPropertiesPropertyName] = (JsonNode)false; 138requiredProps.Add((JsonNode)prop.Key); 145schemaObj.TryGetPropertyValue(TypePropertyName, out JsonNode? typeSchema) && 151foreach (JsonNode? typeNode in typeArray) 172schemaObj["type"] = (JsonNode)foundType; 173schemaObj["nullable"] = (JsonNode)true; 178schemaObj.TryGetPropertyValue(DefaultPropertyName, out JsonNode? defaultSchema)) 180string? description = schemaObj.TryGetPropertyValue(DescriptionPropertyName, out JsonNode? descriptionSchema) ? descriptionSchema?.GetValue<string>() : null;
Microsoft.Extensions.AI.Abstractions.Tests (36)
AssertExtensions.cs (1)
99if (!JsonNode.DeepEquals(
Contents\FunctionCallContentTests.cs (3)
84var json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options); 174var arguments = JsonSerializer.Deserialize<Dictionary<string, JsonNode>>(""" 231AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, JsonNode>>("""
test\Shared\JsonSchemaExporter\SchemaTestHelpers.cs (11)
17public static void AssertEqualJsonSchema(JsonNode expectedJsonSchema, JsonNode actualJsonSchema) 19if (!JsonNode.DeepEquals(expectedJsonSchema, actualJsonSchema)) 31public static void AssertDocumentMatchesSchema(JsonNode schema, JsonNode? instance) 52public static void AssertDoesNotMatchSchema(JsonNode schema, JsonNode? instance) 67private static EvaluationResults EvaluateSchemaCore(JsonNode schema, JsonNode? instance) 74private static string FormatJson(JsonNode? node) => 78[JsonSerializable(typeof(JsonNode))]
test\Shared\JsonSchemaExporter\TestData.cs (3)
30JsonNode ITestData.ExpectedJsonSchema { get; } = 31JsonNode.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions) 63JsonNode ExpectedJsonSchema { get; }
test\Shared\JsonSchemaExporter\TestTypes.cs (6)
103yield return new TestData<JsonNode>(JsonNode.Parse("""[{ "x" : 42 }]"""), "true"); 106yield return new TestData<JsonArray>([(JsonNode)1, (JsonNode)2, (JsonNode)3], """{"type":["array","null"]}"""); 1247[JsonSerializable(typeof(JsonNode))]
TestJsonSerializerContext.cs (1)
32[JsonSerializable(typeof(Dictionary<string, JsonNode>))] // Used in Content tests
Utilities\AIJsonUtilitiesTests.cs (11)
100case null when property.PropertyType == typeof(Func<AIJsonSchemaCreateContext, JsonNode, JsonNode>): 101Func<AIJsonSchemaCreateContext, JsonNode, JsonNode> transformer = static (context, schema) => (JsonNode)true; 486JsonNode? schemaAsNode = JsonSerializer.SerializeToNode(schema, options); 499JsonNode? serializedValue = JsonSerializer.SerializeToNode(testData.Value, testData.Type, options); 1361schemaObj.Add("myAwesomeKeyword", (JsonNode)42); 1377if (schemaObj.TryGetPropertyValue("properties", out JsonNode? props)) 1384if (schemaObj.TryGetPropertyValue("type", out JsonNode? type) && type is JsonArray typeArray) 1437return JsonNode.DeepEquals(
Microsoft.Extensions.AI.AzureAIInference.Tests (1)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (1)
99if (!JsonNode.DeepEquals(
Microsoft.Extensions.AI.Evaluation.Quality (5)
AIToolExtensions.cs (3)
24JsonNode functionJsonNode = 29["functionSchema"] = JsonNode.Parse(function.JsonSchema.GetRawText()), 35JsonNode.Parse(function.ReturnJsonSchema.Value.GetRawText());
ChatMessageExtensions.cs (1)
21JsonNode? messageJsonNode =
ChatResponseExtensions.cs (1)
36JsonNode? toolCallOrResultJsonNode =
Microsoft.Extensions.AI.Evaluation.Safety (4)
EvaluationMetricExtensions.cs (4)
81JsonNode? jsonData = JsonNode.Parse(data); 87Failed to parse supplied {nameof(data)} below into a {nameof(JsonNode)}. 97internal static void LogJsonData(this EvaluationMetric metric, JsonNode data)
Microsoft.Extensions.AI.Integration.Tests (5)
VerbatimHttpHandler.cs (5)
108JsonNode? expectedNode = null; 109JsonNode? actualNode = null; 112expectedNode = JsonNode.Parse(expected); 113actualNode = JsonNode.Parse(actual); 121if (!JsonNode.DeepEquals(expectedNode, actualNode))
Microsoft.Extensions.AI.OpenAI (5)
OpenAIClientExtensions.cs (1)
89static void AppendLine(ref StringBuilder? sb, string propName, JsonNode propNode)
OpenAIResponsesChatClient.cs (4)
629if (JsonNode.Parse(rcoJsonBinaryData.ToMemory().Span) is JsonObject rcoJsonObject) 632if (rcoJsonObject.TryGetPropertyValue(ConversationPropertyName, out JsonNode? existingConversationNode)) 642existingConversationNode.AsObject().TryGetPropertyValue("id", out JsonNode? idNode) && idNode?.GetValueKind() == JsonValueKind.String ? 653rcoJsonBinaryData = new(JsonSerializer.SerializeToUtf8Bytes(rcoJsonObject, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(JsonNode))));
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIResponseClientTests.cs (1)
3341JsonObject rcoJsonObject = Assert.IsType<JsonObject>(JsonNode.Parse(rcoJsonBinaryData.ToMemory().Span));
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (1)
99if (!JsonNode.DeepEquals(
Microsoft.Extensions.AI.Tests (4)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (1)
488return System.Text.Json.Nodes.JsonNode.DeepEquals(
Functions\AIFunctionFactoryTest.cs (1)
134["y"] = JsonNode.Parse("2"),
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (1)
99if (!JsonNode.DeepEquals(
TestJsonSerializerContext.cs (1)
23[JsonSerializable(typeof(Dictionary<string, JsonNode>))]
Microsoft.ML.AutoML (12)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (3)
17var jValue = JsonValue.Parse(ref reader); 26var jsonObject = JsonNode.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
18var jsonObject = JsonValue.Parse(ref reader); 29var jObject = JsonObject.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (4)
17var jNode = JsonNode.Parse(ref reader); 29var jNode = JsonNode.Parse("{}");
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
17var jValue = JsonValue.Parse(ref reader); 27var jsonObject = JsonNode.Parse("{}");
Microsoft.ML.AutoML.SourceGenerator (5)
SearchSpaceGenerator.cs (5)
35var searchSpacesJNodes = searchSpacesJson.Select(x => JsonNode.Parse(x)); 37foreach (var jNode in searchSpacesJNodes) 65var defaultToken = t.AsObject().ContainsKey("default") ? t["default"] : null; 86var searchSpaceNode = t.AsObject().ContainsKey("search_space") ? t["search_space"] : null; 96var minToken = searchSpaceNode["min"];
Microsoft.NET.Build.Containers.UnitTests (40)
ImageBuilderTests.cs (37)
70JsonNode? node = JsonNode.Parse(simpleImageConfig); 80JsonNode? result = JsonNode.Parse(readyImage); 141JsonNode? node = JsonNode.Parse(simpleImageConfig); 151JsonNode? result = JsonNode.Parse(readyImage); 209JsonNode? node = JsonNode.Parse(simpleImageConfig); 219JsonNode? result = JsonNode.Parse(readyImage); 281JsonNode? node = JsonNode.Parse(simpleImageConfig); 293JsonNode? result = JsonNode.Parse(readyImage); 370JsonNode? node = JsonNode.Parse(simpleImageConfig); 377JsonNode? result = JsonNode.Parse(readyImage); 379var historyNode = result?["history"]; 382var layerDiffsNode = result?["rootfs"]?["diff_ids"]; 428JsonNode? result = JsonNode.Parse(builtImage.Config); 470JsonNode? result = JsonNode.Parse(builtImage.Config); 514JsonNode? result = JsonNode.Parse(builtImage.Config); 560JsonNode? result = JsonNode.Parse(builtImage.Config); 603var config = JsonNode.Parse(baseConfigBuilder.Build().Config); 643JsonNode? result = JsonNode.Parse(builtImage.Config); 684JsonNode? result = JsonNode.Parse(builtImage.Config); 687var digest = labels?.AsEnumerable().First(label => label.Key == "org.opencontainers.image.base.digest").Value!;
ImageConfigTests.cs (3)
53JsonNode after = JsonNode.Parse(c.BuildConfig())!; 54JsonNode? prop = after["config"]?[property];
Microsoft.NET.Build.Tests (3)
GivenThatWeWantToResolveConflicts.cs (3)
498var root = JsonNode.Parse(json); 500foreach (var item in items)
Microsoft.NET.Sdk.Web.Tests (3)
PublishTests.cs (3)
41JsonNode runtimeConfig = JsonNode.Parse(runtimeConfigContents); 42JsonNode configProperties = runtimeConfig["runtimeOptions"]["configProperties"];
Microsoft.TemplateEngine.Cli (10)
PostActionProcessors\AddJsonPropertyPostActionProcessor.cs (10)
130JsonNode? newJsonContent = AddElementToJson( 151private static JsonNode? AddElementToJson(IPhysicalFileSystem fileSystem, string targetJsonFile, string? propertyPath, string propertyPathSeparator, string newJsonPropertyName, string newJsonPropertyValue, IPostAction action) 153JsonNode? jsonContent = JsonNode.Parse(fileSystem.ReadAllText(targetJsonFile), nodeOptions: null, documentOptions: DeserializerOptions); 166JsonNode? parentProperty = FindJsonNode(jsonContent, propertyPath, propertyPathSeparator, createPath); 176parentProperty[newJsonPropertyName] = JsonNode.Parse(newJsonPropertyValue); 186private static JsonNode? FindJsonNode(JsonNode content, string? nodePath, string pathSeparator, bool createPath) 195JsonNode? node = content; 204JsonNode? childNode = node[property];
Microsoft.TemplateEngine.Cli.UnitTests (17)
PostActionTests\AddJsonPropertyPostActionTests.cs (17)
137[MemberData(nameof(ModifyJsonPostActionTestCase<(JsonNode, bool)>.SuccessTestCases), MemberType = typeof(ModifyJsonPostActionTestCase<(JsonNode, bool)>))] 138public void CanSuccessfullyModifyJsonFile(ModifyJsonPostActionTestCase<(JsonNode, bool)> testCase) 165JsonNode? modifiedJsonContent = JsonNode.Parse(_engineEnvironmentSettings.Host.FileSystem.ReadAllText(jsonFilePath)); 173[MemberData(nameof(ModifyJsonPostActionTestCase<(JsonNode, bool)>.SuccessTestCases), MemberType = typeof(ModifyJsonPostActionTestCase<(JsonNode, bool)>))] 174public void CanSuccessfullyCreateAndModifyJsonFileWhenAllowFileCreationAndPathCreationAreSet(ModifyJsonPostActionTestCase<(JsonNode, bool)> testCase) 200JsonNode? modifiedJsonContent = JsonNode.Parse(_engineEnvironmentSettings.Host.FileSystem.ReadAllText(jsonFilePath)); 208[MemberData(nameof(ModifyJsonPostActionTestCase<(JsonNode, bool)>.SuccessTestCases), MemberType = typeof(ModifyJsonPostActionTestCase<(JsonNode, bool)>))] 209public void CanSuccessfullyModifyJsonFileWhenPathDoesNotExistAndAllowPathCreationIsSet(ModifyJsonPostActionTestCase<(JsonNode, bool)> testCase) 236JsonNode? modifiedJsonContent = JsonNode.Parse(_engineEnvironmentSettings.Host.FileSystem.ReadAllText(jsonFilePath)); 445private static readonly ModifyJsonPostActionTestCase<(JsonNode ResultingJson, bool IsNewJson)>[] _successTestCases = 571foreach (ModifyJsonPostActionTestCase<(JsonNode, bool)> testCase in _successTestCases)
MSBuild (3)
JsonOutputFormatter.cs (3)
21private readonly JsonNode _topLevelNode = new JsonObject(); 37JsonNode propertiesNode = new JsonObject(); 55JsonNode itemsNode = new JsonObject();
Roslyn.VisualStudio.Next.UnitTests (9)
UnifiedSettings\UnifiedSettingsTests.cs (9)
131var jsonDocument = await JsonNode.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }); 144var jsonDocument = await JsonNode.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }); 231var jsonDocument = await JsonNode.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }); 244var jsonDocument = await JsonNode.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }); 254private static void VerifyProperties(JsonNode jsonDocument, string prefix, ImmutableArray<(IOption2, UnifiedSettingBase)> expectedOptionToSettings)
Sample (4)
artifacts\obj\Sample\Release\net10.0\generated\Microsoft.AspNetCore.OpenApi.SourceGenerators\Microsoft.AspNetCore.OpenApi.SourceGenerators.XmlCommentGenerator\OpenApiXmlCommentSupport.generated.cs (4)
517var parsedExample = jsonString.Parse(); 627public static JsonNode? Parse(this string? json) 636return JsonNode.Parse(json); 643return JsonNode.Parse($"\"{json.Replace("\"", "\\\"")}\"");
Shared.Tests (30)
JsonSchemaExporter\JsonSchemaExporterTests.cs (10)
34JsonNode schema = options.GetJsonSchemaAsNode(testData.Type, (JsonSchemaExporterOptions?)testData.ExporterOptions); 46JsonNode schema = options.GetJsonSchemaAsNode(testData.Type, (JsonSchemaExporterOptions?)testData.ExporterOptions); 47JsonNode? instance = JsonSerializer.SerializeToNode(testData.Value, testData.Type, options); 60JsonNode schema = Options.GetJsonSchemaAsNode(referenceType, config); 76JsonNode schema = Options.GetJsonSchemaAsNode(referenceType, config); 85JsonNode schema = Options.GetJsonSchemaAsNode(typeof(XElement)); 126JsonNode schema = Options.GetJsonSchemaAsNode(typeof(object), config); 133JsonNode schema = Options.GetJsonSchemaAsNode(typeof(TestTypes.PocoDisallowingUnmappedMembers)); 134JsonNode? jsonWithUnmappedProperties = JsonNode.Parse("""{ "UnmappedProperty" : {} }""");
JsonSchemaExporter\SchemaTestHelpers.cs (11)
17public static void AssertEqualJsonSchema(JsonNode expectedJsonSchema, JsonNode actualJsonSchema) 19if (!JsonNode.DeepEquals(expectedJsonSchema, actualJsonSchema)) 31public static void AssertDocumentMatchesSchema(JsonNode schema, JsonNode? instance) 52public static void AssertDoesNotMatchSchema(JsonNode schema, JsonNode? instance) 67private static EvaluationResults EvaluateSchemaCore(JsonNode schema, JsonNode? instance) 74private static string FormatJson(JsonNode? node) => 78[JsonSerializable(typeof(JsonNode))]
JsonSchemaExporter\TestData.cs (3)
30JsonNode ITestData.ExpectedJsonSchema { get; } = 31JsonNode.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions) 63JsonNode ExpectedJsonSchema { get; }
JsonSchemaExporter\TestTypes.cs (6)
103yield return new TestData<JsonNode>(JsonNode.Parse("""[{ "x" : 42 }]"""), "true"); 106yield return new TestData<JsonArray>([(JsonNode)1, (JsonNode)2, (JsonNode)3], """{"type":["array","null"]}"""); 1247[JsonSerializable(typeof(JsonNode))]
System.Text.Json (477)
System\Text\Json\Nodes\JsonArray.cs (31)
24private List<JsonNode?>? _list; 39public JsonArray(JsonNodeOptions options, params JsonNode?[] items) : base(options) 49public JsonArray(JsonNodeOptions options, params ReadOnlySpan<JsonNode?> items) : base(options) 58public JsonArray(params JsonNode?[] items) : base() 67public JsonArray(params ReadOnlySpan<JsonNode?> items) : base() 74internal override JsonNode DeepCloneCore() 76GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 87_list = new List<JsonNode?>(list.Count) 98internal override bool DeepEqualsCore(JsonNode node) 108List<JsonNode?> currentList = List; 109List<JsonNode?> otherList = array.List; 131internal int GetElementIndex(JsonNode? node) 137/// Returns an enumerable that wraps calls to <see cref="JsonNode.GetValue{T}"/>. 143foreach (JsonNode? item in List) 149private void InitializeFromArray(JsonNode?[] items) 151var list = new List<JsonNode?>(items); 161private void InitializeFromSpan(ReadOnlySpan<JsonNode?> items) 163List<JsonNode?> list = new(items.Length); 220JsonNode? nodeToAdd = ConvertFromValue(value, Options); 227private List<JsonNode?> List => _list ?? InitializeList(); 229private protected override JsonNode? GetItem(int index) 234private protected override void SetItem(int index, JsonNode? value) 241internal override void GetPath(ref ValueStringBuilder path, JsonNode? child) 268GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 278foreach (JsonNode? element in List) 294private List<JsonNode?> InitializeList() 296GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement); 305list = new List<JsonNode?>(jElement.GetArrayLength()); 309JsonNode? node = JsonNodeConverter.Create(element, Options); 332private void GetUnderlyingRepresentation(out List<JsonNode?>? list, out JsonElement? jsonElement) 376public JsonNode? Value;
System\Text\Json\Nodes\JsonArray.IList.cs (21)
17/// Adds a <see cref="JsonNode"/> to the end of the <see cref="JsonArray"/>. 20/// The <see cref="JsonNode"/> to be added to the end of the <see cref="JsonArray"/>. 22public void Add(JsonNode? item) 34List<JsonNode?>? list = _list; 58public bool Contains(JsonNode? item) => List.Contains(item); 63/// <param name="item">The <see cref="JsonNode"/> to locate in the <see cref="JsonArray"/>.</param> 67public int IndexOf(JsonNode? item) => List.IndexOf(item); 73/// <param name="item">The <see cref="JsonNode"/> to insert.</param> 77public void Insert(int index, JsonNode? item) 84/// Removes the first occurrence of a specific <see cref="JsonNode"/> from the <see cref="JsonArray"/>. 87/// The <see cref="JsonNode"/> to remove from the <see cref="JsonArray"/>. 92public bool Remove(JsonNode? item) 112JsonNode? item = List[index]; 125public int RemoveAll(Func<JsonNode?, bool> match) 166List<JsonNode?> list = List; 208void ICollection<JsonNode?>.CopyTo(JsonNode?[] array, int index) => List.CopyTo(array, index); 213/// <returns>A <see cref="IEnumerator{JsonNode}"/> for the <see cref="JsonNode"/>.</returns> 214public IEnumerator<JsonNode?> GetEnumerator() => List.GetEnumerator(); 227bool ICollection<JsonNode?>.IsReadOnly => false; 231private static void DetachParent(JsonNode? item)
System\Text\Json\Nodes\JsonNode.cs (30)
16/// declared as an <see cref="object"/> should be deserialized as a <see cref="JsonNode"/>. 22private JsonNode? _parent; 118/// Gets the parent <see cref="JsonNode"/>. 122public JsonNode? Parent 151internal abstract void GetPath(ref ValueStringBuilder path, JsonNode? child); 154/// Gets the root <see cref="JsonNode"/>. 159public JsonNode Root 163JsonNode? parent = Parent; 193/// The current <see cref="JsonNode"/> cannot be represented as a {T}. 196/// The current <see cref="JsonNode"/> is not a <see cref="JsonValue"/> or 210/// The current <see cref="JsonNode"/> is not a <see cref="JsonArray"/> or <see cref="JsonObject"/>. 212public JsonNode? this[int index] 218private protected virtual JsonNode? GetItem(int index) 224private protected virtual void SetItem(int index, JsonNode? node) => 236/// The current <see cref="JsonNode"/> is not a <see cref="JsonObject"/>. 238public JsonNode? this[string propertyName] 251/// Creates a new instance of the <see cref="JsonNode"/>. All children nodes are recursively cloned. 254public JsonNode DeepClone() => DeepCloneCore(); 256internal abstract JsonNode DeepCloneCore(); 304/// <param name="node1">The <see cref="JsonNode"/> to compare.</param> 305/// <param name="node2">The <see cref="JsonNode"/> to compare.</param> 307public static bool DeepEquals(JsonNode? node1, JsonNode? node2) 321internal abstract bool DeepEqualsCore(JsonNode node); 332JsonNode? node; 346internal void AssignParent(JsonNode parent) 353JsonNode? p = parent; 369/// to support arbitrary <see cref="JsonElement"/> and <see cref="JsonNode"/> values. 374internal static JsonNode? ConvertFromValue<T>(T? value, JsonNodeOptions? options = null) 381if (value is JsonNode node)
System\Text\Json\Nodes\JsonNode.Operators.cs (198)
11/// Defines an implicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 14/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 15public static implicit operator JsonNode(bool value) => JsonValue.Create(value); 18/// Defines an implicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 21/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 22public static implicit operator JsonNode?(bool? value) => JsonValue.Create(value); 25/// Defines an implicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 28/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 29public static implicit operator JsonNode(byte value) => JsonValue.Create(value); 32/// Defines an implicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 35/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 36public static implicit operator JsonNode?(byte? value) => JsonValue.Create(value); 39/// Defines an implicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 42/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 43public static implicit operator JsonNode(char value) => JsonValue.Create(value); 46/// Defines an implicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 49/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 50public static implicit operator JsonNode?(char? value) => JsonValue.Create(value); 53/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 56/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 57public static implicit operator JsonNode(DateTime value) => JsonValue.Create(value); 60/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 63/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 64public static implicit operator JsonNode?(DateTime? value) => JsonValue.Create(value); 67/// Defines an implicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 70/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 71public static implicit operator JsonNode(DateTimeOffset value) => JsonValue.Create(value); 74/// Defines an implicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 77/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 78public static implicit operator JsonNode?(DateTimeOffset? value) => JsonValue.Create(value); 81/// Defines an implicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 84/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 85public static implicit operator JsonNode(decimal value) => JsonValue.Create(value); 88/// Defines an implicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 91/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 92public static implicit operator JsonNode?(decimal? value) => JsonValue.Create(value); 95/// Defines an implicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 98/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 99public static implicit operator JsonNode(double value) => JsonValue.Create(value); 102/// Defines an implicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 105/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 106public static implicit operator JsonNode?(double? value) => JsonValue.Create(value); 109/// Defines an implicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 112/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 113public static implicit operator JsonNode(Guid value) => JsonValue.Create(value); 116/// Defines an implicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 119/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 120public static implicit operator JsonNode?(Guid? value) => JsonValue.Create(value); 123/// Defines an implicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 126/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 127public static implicit operator JsonNode(short value) => JsonValue.Create(value); 130/// Defines an implicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 133/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 134public static implicit operator JsonNode?(short? value) => JsonValue.Create(value); 137/// Defines an implicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 140/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 141public static implicit operator JsonNode(int value) => JsonValue.Create(value); 144/// Defines an implicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 147/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 148public static implicit operator JsonNode?(int? value) => JsonValue.Create(value); 151/// Defines an implicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 154/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 155public static implicit operator JsonNode(long value) => JsonValue.Create(value); 158/// Defines an implicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 161/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 162public static implicit operator JsonNode?(long? value) => JsonValue.Create(value); 165/// Defines an implicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 168/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 170public static implicit operator JsonNode(sbyte value) => JsonValue.Create(value); 173/// Defines an implicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 176/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 178public static implicit operator JsonNode?(sbyte? value) => JsonValue.Create(value); 181/// Defines an implicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 184/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 185public static implicit operator JsonNode(float value) => JsonValue.Create(value); 188/// Defines an implicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 191/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 192public static implicit operator JsonNode?(float? value) => JsonValue.Create(value); 195/// Defines an implicit conversion of a given <see cref="string"/> to a <see cref="JsonNode"/>. 198/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 200public static implicit operator JsonNode?(string? value) => JsonValue.Create(value); 203/// Defines an implicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 206/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 208public static implicit operator JsonNode(ushort value) => JsonValue.Create(value); 211/// Defines an implicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 214/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 216public static implicit operator JsonNode?(ushort? value) => JsonValue.Create(value); 219/// Defines an implicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 222/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 224public static implicit operator JsonNode(uint value) => JsonValue.Create(value); 227/// Defines an implicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 230/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 232public static implicit operator JsonNode?(uint? value) => JsonValue.Create(value); 235/// Defines an implicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 238/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 240public static implicit operator JsonNode(ulong value) => JsonValue.Create(value); 243/// Defines an implicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 246/// <returns>A <see cref="JsonNode"/> instance converted from the <paramref name="value"/> parameter.</returns> 248public static implicit operator JsonNode?(ulong? value) => JsonValue.Create(value); 251/// Defines an explicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 254/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 255public static explicit operator bool(JsonNode value) => value.GetValue<bool>(); 258/// Defines an explicit conversion of a given <see cref="bool"/> to a <see cref="JsonNode"/>. 261/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 262public static explicit operator bool?(JsonNode? value) => value?.GetValue<bool>(); 265/// Defines an explicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 268/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 269public static explicit operator byte(JsonNode value) => value.GetValue<byte>(); 272/// Defines an explicit conversion of a given <see cref="byte"/> to a <see cref="JsonNode"/>. 275/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 276public static explicit operator byte?(JsonNode? value) => value?.GetValue<byte>(); 279/// Defines an explicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 282/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 283public static explicit operator char(JsonNode value) => value.GetValue<char>(); 286/// Defines an explicit conversion of a given <see cref="char"/> to a <see cref="JsonNode"/>. 289/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 290public static explicit operator char?(JsonNode? value) => value?.GetValue<char>(); 293/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 296/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 297public static explicit operator DateTime(JsonNode value) => value.GetValue<DateTime>(); 300/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="JsonNode"/>. 303/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 304public static explicit operator DateTime?(JsonNode? value) => value?.GetValue<DateTime>(); 307/// Defines an explicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 310/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 311public static explicit operator DateTimeOffset(JsonNode value) => value.GetValue<DateTimeOffset>(); 314/// Defines an explicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="JsonNode"/>. 317/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 318public static explicit operator DateTimeOffset?(JsonNode? value) => value?.GetValue<DateTimeOffset>(); 321/// Defines an explicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 324/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 325public static explicit operator decimal(JsonNode value) => value.GetValue<decimal>(); 328/// Defines an explicit conversion of a given <see cref="decimal"/> to a <see cref="JsonNode"/>. 331/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 332public static explicit operator decimal?(JsonNode? value) => value?.GetValue<decimal>(); 335/// Defines an explicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 338/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 339public static explicit operator double(JsonNode value) => value.GetValue<double>(); 342/// Defines an explicit conversion of a given <see cref="double"/> to a <see cref="JsonNode"/>. 345/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 346public static explicit operator double?(JsonNode? value) => value?.GetValue<double>(); 349/// Defines an explicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 352/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 353public static explicit operator Guid(JsonNode value) => value.GetValue<Guid>(); 356/// Defines an explicit conversion of a given <see cref="Guid"/> to a <see cref="JsonNode"/>. 359/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 360public static explicit operator Guid?(JsonNode? value) => value?.GetValue<Guid>(); 363/// Defines an explicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 366/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 367public static explicit operator short(JsonNode value) => value.GetValue<short>(); 370/// Defines an explicit conversion of a given <see cref="short"/> to a <see cref="JsonNode"/>. 373/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 374public static explicit operator short?(JsonNode? value) => value?.GetValue<short>(); 377/// Defines an explicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 380/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 381public static explicit operator int(JsonNode value) => value.GetValue<int>(); 384/// Defines an explicit conversion of a given <see cref="int"/> to a <see cref="JsonNode"/>. 387/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 388public static explicit operator int?(JsonNode? value) => value?.GetValue<int>(); 391/// Defines an explicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 394/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 395public static explicit operator long(JsonNode value) => value.GetValue<long>(); 398/// Defines an explicit conversion of a given <see cref="long"/> to a <see cref="JsonNode"/>. 401/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 402public static explicit operator long?(JsonNode? value) => value?.GetValue<long>(); 405/// Defines an explicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 408/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 410public static explicit operator sbyte(JsonNode value) => value.GetValue<sbyte>(); 413/// Defines an explicit conversion of a given <see cref="sbyte"/> to a <see cref="JsonNode"/>. 416/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 418public static explicit operator sbyte?(JsonNode? value) => value?.GetValue<sbyte>(); 421/// Defines an explicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 424/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 425public static explicit operator float(JsonNode value) => value.GetValue<float>(); 428/// Defines an explicit conversion of a given <see cref="float"/> to a <see cref="JsonNode"/>. 431/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 432public static explicit operator float?(JsonNode? value) => value?.GetValue<float>(); 435/// Defines an explicit conversion of a given <see cref="string"/> to a <see cref="JsonNode"/>. 438/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 439public static explicit operator string?(JsonNode? value) => value?.GetValue<string>(); 442/// Defines an explicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 445/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 447public static explicit operator ushort(JsonNode value) => value.GetValue<ushort>(); 450/// Defines an explicit conversion of a given <see cref="ushort"/> to a <see cref="JsonNode"/>. 453/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 455public static explicit operator ushort?(JsonNode? value) => value?.GetValue<ushort>(); 458/// Defines an explicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 461/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 463public static explicit operator uint(JsonNode value) => value.GetValue<uint>(); 466/// Defines an explicit conversion of a given <see cref="uint"/> to a <see cref="JsonNode"/>. 469/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 471public static explicit operator uint?(JsonNode? value) => value?.GetValue<uint>(); 474/// Defines an explicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 477/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 479public static explicit operator ulong(JsonNode value) => value.GetValue<ulong>(); 482/// Defines an explicit conversion of a given <see cref="ulong"/> to a <see cref="JsonNode"/>. 485/// <returns>A value converted from the <see cref="JsonNode"/> instance.</returns> 487public static explicit operator ulong?(JsonNode? value) => value?.GetValue<ulong>();
System\Text\Json\Nodes\JsonNode.Parse.cs (12)
20/// The <see cref="JsonNode"/> from the reader. 47public static JsonNode? Parse( 62/// A <see cref="JsonNode"/> representation of the JSON value. 70public static JsonNode? Parse( 88/// A <see cref="JsonNode"/> representation of the JSON value. 93public static JsonNode? Parse( 104/// <see cref="JsonNode"/>. The Stream will be read to completion. 110/// A <see cref="JsonNode"/> representation of the JSON value. 115public static JsonNode? Parse( 128/// <see cref="JsonNode"/>. The Stream will be read to completion. 135/// A <see cref="Task"/> to produce a <see cref="JsonNode"/> representation of the JSON value. 140public static async Task<JsonNode?> ParseAsync(
System\Text\Json\Nodes\JsonNode.To.cs (1)
70/// Write the <see cref="JsonNode"/> into the provided <see cref="Utf8JsonWriter"/> as JSON.
System\Text\Json\Nodes\JsonNodeOptions.cs (1)
7/// Options to control <see cref="JsonNode"/> behavior.
System\Text\Json\Nodes\JsonObject.cs (33)
36public JsonObject(IEnumerable<KeyValuePair<string, JsonNode?>> properties, JsonNodeOptions? options = null) : this(options) 38int capacity = properties is ICollection<KeyValuePair<string, JsonNode?>> propertiesCollection ? propertiesCollection.Count : 0; 39OrderedDictionary<string, JsonNode?> dictionary = CreateDictionary(options, capacity); 41foreach (KeyValuePair<string, JsonNode?> node in properties) 78private OrderedDictionary<string, JsonNode?> Dictionary => _dictionary ?? InitializeDictionary(); 80private protected override JsonNode? GetItem(int index) => GetAt(index).Value; 81private protected override void SetItem(int index, JsonNode? value) => SetAt(index, value); 83internal override JsonNode DeepCloneCore() 85GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 99foreach (KeyValuePair<string, JsonNode?> item in dictionary) 107internal string GetPropertyName(JsonNode? node) 109KeyValuePair<string, JsonNode?>? item = FindValue(node); 124public bool TryGetPropertyValue(string propertyName, out JsonNode? jsonNode) => TryGetPropertyValue(propertyName, out jsonNode, out _); 141public bool TryGetPropertyValue(string propertyName, out JsonNode? jsonNode, out int index) 165GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 176foreach (KeyValuePair<string, JsonNode?> entry in Dictionary) 196internal override bool DeepEqualsCore(JsonNode node) 206OrderedDictionary<string, JsonNode?> currentDict = Dictionary; 207OrderedDictionary<string, JsonNode?> otherDict = jsonObject.Dictionary; 214foreach (KeyValuePair<string, JsonNode?> item in currentDict) 216if (!otherDict.TryGetValue(item.Key, out JsonNode? jsonNode) || !DeepEquals(item.Value, jsonNode)) 229internal JsonNode? GetItem(string propertyName) 233if (TryGetPropertyValue(propertyName, out JsonNode? value)) 242internal override void GetPath(ref ValueStringBuilder path, JsonNode? child) 263internal void SetItem(string propertyName, JsonNode? value) 267OrderedDictionary<string, JsonNode?> dict = Dictionary; 281JsonNode? replacedValue = dict.GetAt(index).Value; 295private void DetachParent(JsonNode? item) 302private KeyValuePair<string, JsonNode?>? FindValue(JsonNode? value) 304foreach (KeyValuePair<string, JsonNode?> item in Dictionary) 337foreach (KeyValuePair<string, JsonNode?> item in _node) 352public JsonNode? Value;
System\Text\Json\Nodes\JsonObject.IDictionary.cs (31)
13private OrderedDictionary<string, JsonNode?>? _dictionary; 26public void Add(string propertyName, JsonNode? value) 43public bool TryAdd(string propertyName, JsonNode? value) => TryAdd(propertyName, value, out _); 55public bool TryAdd(string propertyName, JsonNode? value, out int index) 86public void Add(KeyValuePair<string, JsonNode?> property) => Add(property.Key, property.Value); 93OrderedDictionary<string, JsonNode?>? dictionary = _dictionary; 101foreach (JsonNode? node in dictionary.Values) 145bool success = Dictionary.Remove(propertyName, out JsonNode? removedNode); 155/// Determines whether the <see cref="JsonObject"/> contains a specific property name and <see cref="JsonNode"/> reference. 161bool ICollection<KeyValuePair<string, JsonNode?>>.Contains(KeyValuePair<string, JsonNode?> item) => 162((IDictionary<string, JsonNode?>)Dictionary).Contains(item); 181void ICollection<KeyValuePair<string, JsonNode?>>.CopyTo(KeyValuePair<string, JsonNode?>[] array, int index) => 182((IDictionary<string, JsonNode?>)Dictionary).CopyTo(array, index); 190public IEnumerator<KeyValuePair<string, JsonNode?>> GetEnumerator() => Dictionary.GetEnumerator(); 201bool ICollection<KeyValuePair<string, JsonNode?>>.Remove(KeyValuePair<string, JsonNode?> item) => Remove(item.Key); 206ICollection<string> IDictionary<string, JsonNode?>.Keys => Dictionary.Keys; 211ICollection<JsonNode?> IDictionary<string, JsonNode?>.Values => Dictionary.Values; 227bool IDictionary<string, JsonNode?>.TryGetValue(string propertyName, out JsonNode? jsonNode) 237bool ICollection<KeyValuePair<string, JsonNode?>>.IsReadOnly => false; 247private OrderedDictionary<string, JsonNode?> InitializeDictionary() 249GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement); 253OrderedDictionary<string, JsonNode?> newDictionary = CreateDictionary(Options); 259JsonNode? node = JsonNodeConverter.Create(jElementProperty.Value, Options); 267OrderedDictionary<string, JsonNode?>? exchangedDictionary = Interlocked.CompareExchange(ref _dictionary, newDictionary, null); 285private static OrderedDictionary<string, JsonNode?> CreateDictionary(JsonNodeOptions? options, int capacity = 0) 298private void GetUnderlyingRepresentation(out OrderedDictionary<string, JsonNode?>? dictionary, out JsonElement? jsonElement)
System\Text\Json\Nodes\JsonObject.IList.cs (17)
15public KeyValuePair<string, JsonNode?> GetAt(int index) => Dictionary.GetAt(index); 24public void SetAt(int index, string propertyName, JsonNode? value) 28OrderedDictionary<string, JsonNode?> dictionary = Dictionary; 29KeyValuePair<string, JsonNode?> existing = dictionary.GetAt(index); 40public void SetAt(int index, JsonNode? value) 42OrderedDictionary<string, JsonNode?> dictionary = Dictionary; 43KeyValuePair<string, JsonNode?> existing = dictionary.GetAt(index); 67public void Insert(int index, string propertyName, JsonNode? value) 80KeyValuePair<string, JsonNode?> existing = Dictionary.GetAt(index); 86KeyValuePair<string, JsonNode?> IList<KeyValuePair<string, JsonNode?>>.this[int index] 93int IList<KeyValuePair<string, JsonNode?>>.IndexOf(KeyValuePair<string, JsonNode?> item) => ((IList<KeyValuePair<string, JsonNode?>>)Dictionary).IndexOf(item); 96void IList<KeyValuePair<string, JsonNode?>>.Insert(int index, KeyValuePair<string, JsonNode?> item) => Insert(index, item.Key, item.Value); 99void IList<KeyValuePair<string, JsonNode?>>.RemoveAt(int index) => RemoveAt(index);
System\Text\Json\Nodes\JsonValue.cs (6)
32/// <seealso cref="JsonNode.GetValue{T}"></seealso> 57if (value is JsonNode) 91if (value is JsonNode) 106internal override bool DeepEqualsCore(JsonNode otherNode) 126static JsonElement ToJsonElement(JsonNode node, out JsonDocument? backingDocument) 154internal sealed override void GetPath(ref ValueStringBuilder path, JsonNode? child)
System\Text\Json\Nodes\JsonValueOfElement.cs (2)
20internal override JsonNode DeepCloneCore() => new JsonValueOfElement(Value.Clone(), Options); 23internal override bool DeepEqualsCore(JsonNode otherNode)
System\Text\Json\Nodes\JsonValueOfJsonPrimitive.cs (3)
46internal override JsonNode DeepCloneCore() => new JsonValueOfJsonString(_value, Options); 137internal override JsonNode DeepCloneCore() => new JsonValueOfJsonBool(_value, Options); 184internal override JsonNode DeepCloneCore() => new JsonValueOfJsonNumber(_value, Options);
System\Text\Json\Nodes\JsonValueOfT.cs (1)
19Debug.Assert(value is not JsonNode);
System\Text\Json\Nodes\JsonValueOfTCustomized.cs (1)
27internal override JsonNode DeepCloneCore() => JsonSerializer.SerializeToNode(Value, _jsonTypeInfo)!;
System\Text\Json\Nodes\JsonValueOfTPrimitive.cs (2)
28internal override JsonNode DeepCloneCore() => new JsonValuePrimitive<TValue>(Value, _converter, Options); 30internal override bool DeepEqualsCore(JsonNode otherNode)
System\Text\Json\Schema\JsonSchema.cs (14)
62public JsonNode? Constant { get => _constant; set { VerifyMutable(); _constant = value; } } 63private JsonNode? _constant; 89public JsonNode? DefaultValue { get => _defaultValue; set { VerifyMutable(); _defaultValue = value; } } 90private JsonNode? _defaultValue; 151public JsonNode ToJsonNode(JsonSchemaExporterOptions options) 155return CompleteSchema((JsonNode)boolSchema); 170if (MapSchemaType(Type) is JsonNode type) 206requiredArray.Add((JsonNode)requiredProperty); 250objSchema.Add(MinLengthPropertyName, (JsonNode)minLength); 255objSchema.Add(MaxLengthPropertyName, (JsonNode)maxLength); 260JsonNode CompleteSchema(JsonNode schema) 312public static JsonNode? MapSchemaType(JsonSchemaType schemaType) 329array.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. 27public 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. 43public static JsonNode GetJsonSchemaAsNode(this JsonTypeInfo typeInfo, JsonSchemaExporterOptions? exporterOptions = null) 114JsonNode discriminatorNode = discriminatorValue switch 116string stringId => (JsonNode)stringId, 117_ => (JsonNode)(int)discriminatorValue,
System\Text\Json\Schema\JsonSchemaExporterOptions.cs (2)
31public Func<JsonSchemaExporterContext, JsonNode, JsonNode>? TransformSchemaNode { get; init; }
System\Text\Json\Serialization\Attributes\JsonExtensionDataAttribute.cs (1)
18/// <see cref="object"/>, the type of object created will either be a <see cref="System.Text.Json.Nodes.JsonNode"/> or a
System\Text\Json\Serialization\Converters\Node\JsonArrayConverter.cs (1)
57JsonNode? item = JsonNodeConverter.ReadAsJsonNode(ref reader, options);
System\Text\Json\Serialization\Converters\Node\JsonNodeConverter.cs (7)
14internal sealed class JsonNodeConverter : JsonConverter<JsonNode?> 18public override void Write(Utf8JsonWriter writer, JsonNode? value, JsonSerializerOptions options) 30public override JsonNode? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 37internal static JsonNode? ReadAsJsonElement(ref Utf8JsonReader reader, JsonNodeOptions options) 58internal static JsonNode? ReadAsJsonNode(ref Utf8JsonReader reader, JsonNodeOptions options) 79public static JsonNode? Create(JsonElement element, JsonNodeOptions? options) 81JsonNode? node;
System\Text\Json\Serialization\Converters\Node\JsonNodeConverterFactory.cs (2)
33Debug.Assert(typeof(JsonNode) == typeToConvert); 37public override bool CanConvert(Type typeToConvert) => typeof(JsonNode).IsAssignableFrom(typeToConvert);
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (5)
25bool success = JsonNodeConverter.Instance.TryRead(ref reader, typeof(JsonNode), options, ref state, out JsonNode? value, out _); 31Debug.Assert(value == null || value is JsonNode); 32JsonNode? jNodeValue = value; 98JsonNode? value = JsonNodeConverter.ReadAsJsonNode(ref reader, options);
System\Text\Json\Serialization\Converters\Object\ObjectConverter.cs (1)
132JsonNode? node = JsonNodeConverter.Instance.Read(ref reader, typeToConvert, options);
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (1)
505enumValues.Add((JsonNode)fieldInfo.JsonName);
System\Text\Json\Serialization\Converters\Value\JsonPrimitiveConverter.cs (3)
60new JsonSchema { Enum = [(JsonNode)"NaN", (JsonNode)"Infinity", (JsonNode)"-Infinity"] },
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (3)
416JsonNode? jsonNode, 425foreach (KeyValuePair<string, JsonNode?> property in jsonObject) 463static string ReadAsStringMetadataValue(JsonNode? jsonNode)
System\Text\Json\Serialization\JsonSerializer.Read.HandlePropertyName.cs (1)
134genericArgs[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> 30public static TValue? Deserialize<TValue>(this JsonNode? node, JsonSerializerOptions? options = null) 37/// Converts the <see cref="JsonNode"/> representing a single JSON value into a <paramref name="returnType"/>. 40/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 52public static object? Deserialize(this JsonNode? node, Type returnType, JsonSerializerOptions? options = null) 61/// Converts the <see cref="JsonNode"/> representing a single JSON value into a <typeparamref name="TValue"/>. 65/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 73public static TValue? Deserialize<TValue>(this JsonNode? node, JsonTypeInfo<TValue> jsonTypeInfo) 82/// Converts the <see cref="JsonNode"/> representing a single JSON value into an instance specified by the <paramref name="jsonTypeInfo"/>. 85/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 90public static object? Deserialize(this JsonNode? node, JsonTypeInfo jsonTypeInfo) 99/// Converts the <see cref="JsonNode"/> representing a single JSON value into a <paramref name="returnType"/>. 102/// <param name="node">The <see cref="JsonNode"/> to convert.</param> 130public static object? Deserialize(this JsonNode? node, Type returnType, JsonSerializerContext context) 139private static TValue? ReadFromNode<TValue>(JsonNode? node, JsonTypeInfo<TValue> jsonTypeInfo) 160private static object? ReadFromNodeAsObject(JsonNode? node, JsonTypeInfo jsonTypeInfo)
System\Text\Json\Serialization\JsonSerializer.Write.Node.cs (19)
15/// Converts the provided value into a <see cref="JsonNode"/>. 18/// <returns>A <see cref="JsonNode"/> representation of the JSON value.</returns> 27public static JsonNode? SerializeToNode<TValue>(TValue value, JsonSerializerOptions? options = null) 34/// Converts the provided value into a <see cref="JsonNode"/>. 36/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 52public static JsonNode? SerializeToNode(object? value, Type inputType, JsonSerializerOptions? options = null) 60/// Converts the provided value into a <see cref="JsonNode"/>. 63/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 69public static JsonNode? SerializeToNode<TValue>(TValue value, JsonTypeInfo<TValue> jsonTypeInfo) 78/// Converts the provided value into a <see cref="JsonNode"/>. 80/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 89public static JsonNode? SerializeToNode(object? value, JsonTypeInfo jsonTypeInfo) 98/// Converts the provided value into a <see cref="JsonNode"/>. 100/// <returns>A <see cref="JsonNode"/> representation of the value.</returns> 115public static JsonNode? SerializeToNode(object? value, Type inputType, JsonSerializerContext context) 124private static JsonNode? WriteNode<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo) 134return JsonNode.Parse(output.WrittenSpan, options.GetNodeOptions(), options.GetDocumentOptions()); 142private static JsonNode? WriteNodeAsObject(object? value, JsonTypeInfo jsonTypeInfo) 152return JsonNode.Parse(output.WrittenSpan, options.GetNodeOptions(), options.GetDocumentOptions());
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
143/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonNode"/> values. 146public static JsonConverter<JsonNode?> JsonNodeConverter => s_jsonNodeConverter ??= new JsonNodeConverter(); 147private static JsonConverter<JsonNode?>? s_jsonNodeConverter;
System.Windows.Forms.Analyzers.Tests (3)
CurrentReferences.cs (3)
142JsonObject? jsonObject = JsonNode.Parse(globalJsonString)?.AsObject(); 155JsonObject? jsonObject = JsonNode.Parse(configJsonString)?.AsObject(); 156JsonNode? runtimeOptions = jsonObject?["runtimeOptions"];