7 types derived from JsonNode
System.Text.Json (7)
System\Text\Json\Nodes\JsonArray.cs (1)
21
public sealed partial class JsonArray :
JsonNode
System\Text\Json\Nodes\JsonArray.IList.cs (2)
9
public sealed partial class JsonArray :
JsonNode
, IList<
JsonNode
?>
System\Text\Json\Nodes\JsonObject.cs (1)
19
public sealed partial class JsonObject :
JsonNode
System\Text\Json\Nodes\JsonObject.IDictionary.cs (1)
11
public partial class JsonObject : IDictionary<string,
JsonNode
?>
System\Text\Json\Nodes\JsonObject.IList.cs (1)
9
public partial class JsonObject : IList<KeyValuePair<string,
JsonNode
?>>
System\Text\Json\Nodes\JsonValue.cs (1)
14
public abstract partial class JsonValue :
JsonNode
846 references to JsonNode
Aspire.Components.Common.Tests (4)
ConformanceTests.cs (4)
326
var
config =
JsonNode
.Parse(ValidJsonConfig);
340
var
config =
JsonNode
.Parse(json);
Aspire.Dashboard (1)
Otlp\Model\OtlpHelpers.cs (1)
118
private static
JsonNode
? ConvertAnyValue(AnyValue value)
Aspire.Hosting (4)
Dcp\DcpExecutor.cs (2)
1472
var
current = JsonSerializer.SerializeToNode(obj);
1477
var
changed = JsonSerializer.SerializeToNode(copy);
Devcontainers\DevcontainerSettingsWriter.cs (2)
72
if (!settings.TryGetPropertyValue(PortAttributesFieldName, out
var
portsAttributesNode))
111
if (!portsAttributes.TryGetPropertyValue(port, out
var
portAttributeNode))
Aspire.Hosting.Azure (11)
AzureBicepResource.cs (1)
177
if (inputValue is
JsonNode
|| inputValue is IEnumerable<string>)
AzureBicepResourceExtensions.cs (1)
160
public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name,
JsonNode
value)
Provisioning\JsonExtensions.cs (3)
10
public static
JsonNode
Prop(this
JsonNode
obj, string key)
12
var
node = obj[key];
Provisioning\Provisioners\AzureProvisioner.cs (1)
188
?
JsonNode
.Parse(await File.ReadAllTextAsync(userSecretsPath, cancellationToken).ConfigureAwait(false))!.AsObject()
Provisioning\Provisioners\BicepProvisioner.cs (5)
48
JsonNode
? outputObj = null;
51
outputObj =
JsonNode
.Parse(outputJson);
460
var parameters =
JsonNode
.Parse(jsonString)?.AsObject();
462
?
JsonNode
.Parse(scopeString)?.AsObject()
524
JsonNode
node => node,
Aspire.Hosting.Azure.EventHubs (5)
AzureEventHubsExtensions.cs (3)
297
var
jsonObject =
JsonNode
.Parse(readStream);
386
public static IResourceBuilder<AzureEventHubsEmulatorResource> ConfigureEmulator(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, Action<
JsonNode
> configJson)
ConfigJsonAnnotation.cs (2)
14
public ConfigJsonAnnotation(Action<
JsonNode
> configure)
19
public Action<
JsonNode
> Configure { get; }
Aspire.Hosting.Azure.ServiceBus (5)
AzureServiceBusExtensions.cs (3)
411
var
jsonObject =
JsonNode
.Parse(readStream);
479
public static IResourceBuilder<AzureServiceBusEmulatorResource> ConfigureEmulator(this IResourceBuilder<AzureServiceBusEmulatorResource> builder, Action<
JsonNode
> configJson)
ConfigJsonAnnotation.cs (2)
14
public ConfigJsonAnnotation(Action<
JsonNode
> configure)
19
public Action<
JsonNode
> Configure { get; }
Aspire.Hosting.Azure.Tests (19)
AzureBicepResourceTests.cs (19)
1023
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
1048
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
1087
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
1749
var
manifest = await ManifestUtils.GetManifest(postgres.Resource);
2216
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2231
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2246
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2375
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2390
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2405
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2533
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2548
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2563
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2692
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2707
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2722
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2834
var
aiManifest = await ManifestUtils.GetManifest(ai.Resource);
2838
var
serviceBusManifest = await ManifestUtils.GetManifest(serviceBus.Resource);
2842
var
serviceManifest = await ManifestUtils.GetManifest(serviceA.Resource);
Aspire.Hosting.Containers.Tests (5)
ContainerResourceTests.cs (5)
123
var
manifest = await ManifestUtils.GetManifest(c2.Resource);
153
var
manifest = await ManifestUtils.GetManifest(containerResource);
187
var
manifest = await ManifestUtils.GetManifest(containerResource);
234
var
manifest = await ManifestUtils.GetManifest(containerResource);
283
var
manifest = await ManifestUtils.GetManifest(containerResource, manifestDirectory: appHostPath);
Aspire.Hosting.Elasticsearch.Tests (2)
AddElasticsearchTests.cs (2)
162
var
manifest = await ManifestUtils.GetManifest(elasticsearch.Resource);
201
var
manifest = await ManifestUtils.GetManifest(elasticsearch.Resource);
Aspire.Hosting.Garnet.Tests (1)
AddGarnetTests.cs (1)
93
var
manifest = await ManifestUtils.GetManifest(garnet.Resource);
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
81
var
manifest = await ManifestUtils.GetManifest(kafka.Resource);
Aspire.Hosting.Keycloak.Tests (1)
KeycloakResourceBuilderTests.cs (1)
115
var
manifest = await ManifestUtils.GetManifest(keycloak.Resource);
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
133
var
serverManifest = await ManifestUtils.GetManifest(milvus.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
134
var
dbManifest = await ManifestUtils.GetManifest(db1.Resource);
Aspire.Hosting.MongoDB.Tests (2)
AddMongoDBTests.cs (2)
196
var
mongoManifest = await ManifestUtils.GetManifest(mongo.Resource);
197
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
Aspire.Hosting.MySql.Tests (3)
AddMySqlTests.cs (3)
160
var
mySqlManifest = await ManifestUtils.GetManifest(mysql.Resource);
161
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
199
var
serverManifest = await ManifestUtils.GetManifest(mysql.Resource);
Aspire.Hosting.Nats.Tests (2)
AddNatsTests.cs (2)
188
var
manifest = await ManifestUtils.GetManifest(nats.Resource);
225
var
manifest = await ManifestUtils.GetManifest(nats.Resource);
Aspire.Hosting.NodeJs.Tests (1)
AddNodeAppTests.cs (1)
19
var
manifest = await ManifestUtils.GetManifest(nodeApp.Resource);
Aspire.Hosting.Oracle.Tests (3)
AddOracleTests.cs (3)
200
var
serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
201
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
239
var
serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
Aspire.Hosting.PostgreSQL.Tests (3)
AddPostgresTests.cs (3)
249
var
serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
250
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
293
var
serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
Aspire.Hosting.Qdrant.Tests (2)
AddQdrantTests.cs (2)
207
var
serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
245
var
serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
Aspire.Hosting.RabbitMQ.Tests (2)
AddRabbitMQTests.cs (2)
203
var
manifest = await ManifestUtils.GetManifest(rabbit.Resource);
249
var
manifest = await ManifestUtils.GetManifest(rabbit.Resource);
Aspire.Hosting.Redis (3)
RedisBuilderExtensions.cs (3)
424
var
jsonResponse =
JsonNode
.Parse(content);
425
var
agreements = jsonResponse?["agreements"];
Aspire.Hosting.Redis.Tests (5)
AddRedisTests.cs (3)
136
var
manifest = await ManifestUtils.GetManifest(redis.Resource);
170
var
manifest = await ManifestUtils.GetManifest(redis.Resource);
201
var
manifest = await ManifestUtils.GetManifest(redis.Resource);
RedisFunctionalTests.cs (2)
674
var
jo = JsonObject.Parse(content);
676
var
agreements = jo["agreements"];
Aspire.Hosting.SqlServer.Tests (3)
AddSqlServerTests.cs (3)
130
var
serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
131
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
171
var
serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
Aspire.Hosting.Tests (54)
AddParameterTests.cs (4)
151
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout();
201
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout();
259
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout();
314
var
paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "val")).DefaultTimeout();
Dashboard\DashboardResourceTests.cs (1)
518
var
manifest = await ManifestUtils.GetManifestOrNull(dashboard).DefaultTimeout();
ExecutableResourceTests.cs (1)
51
var
manifest = await ManifestUtils.GetManifest(exe2.Resource).DefaultTimeout();
KestrelConfigTests.cs (4)
177
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
221
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
292
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
314
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
ManifestGenerationTests.cs (2)
100
var
redisManifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout();
519
var
manifest = await ManifestUtils.GetManifest(param.Resource).DefaultTimeout();
ProjectResourceTests.cs (2)
481
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
531
var
manifest = await ManifestUtils.GetManifest(resource).DefaultTimeout();
PublishAsConnectionStringTests.cs (1)
21
var
manifest = await ManifestUtils.GetManifest(redis.Resource).DefaultTimeout();
Schema\SchemaTests.cs (16)
235
var
manifestJson =
JsonNode
.Parse(manifestText);
269
var
manifestJson =
JsonNode
.Parse(manifestText);
289
var
manifestJson =
JsonNode
.Parse(manifestText);
308
var
manifestJson =
JsonNode
.Parse(manifestText);
348
var
manifestJson =
JsonNode
.Parse(manifestText);
371
var
manifestJson =
JsonNode
.Parse(manifestText);
749
var
manifestJson =
JsonNode
.Parse(manifestText);
762
var
manifestJson =
JsonNode
.Parse(manifestText);
Utils\ManifestUtils.cs (14)
13
public static async Task<
JsonNode
> GetManifest(IResource resource, string? manifestDirectory = null)
15
var
node = await GetManifestOrNull(resource, manifestDirectory);
20
public static async Task<
JsonNode
?> GetManifestOrNull(IResource resource, string? manifestDirectory = null)
33
var
obj =
JsonNode
.Parse(ms);
35
var
resourceNode = obj[resource.Name];
39
public static async Task<
JsonNode
[]> GetManifests(IResource[] resources)
46
var results = new List<
JsonNode
>();
55
var
obj =
JsonNode
.Parse(ms);
57
var
resourceNode = obj[r.Name];
68
public static async Task<(
JsonNode
ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource)
71
var
manifestNode = await GetManifest(resource, manifestDir);
73
if (!manifestNode.AsObject().TryGetPropertyValue("path", out
var
pathNode))
WithEndpointTests.cs (9)
272
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
300
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
327
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
354
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
381
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
408
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
435
var
manifest = await ManifestUtils.GetManifest(container.Resource).DefaultTimeout();
466
var
manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout();
536
var
manifest = await ManifestUtils.GetManifest(project.Resource).DefaultTimeout();
Aspire.Hosting.Valkey.Tests (1)
AddValkeyTests.cs (1)
93
var
manifest = await ManifestUtils.GetManifest(valkey.Resource);
ConfigurationSchemaGenerator (15)
ConfigSchemaEmitter.cs (15)
119
var
backupTypeNode = currentNode["type"];
174
var
existingValue = propertiesNode[pathSegment];
240
var
backupTypeNode = currentNode["type"];
284
var
backupPropertyNode = currentNode[property.ConfigurationKeyName];
315
var
backupTypeNode = currentNode["type"];
316
var
backupContainerNode = currentNode[containerName];
334
private static void RestoreBackup(
JsonNode
? backupNode, string name, JsonObject parentNode)
449
var
propertyNodeType = propertyNode["type"];
718
private static void ReplaceNodeWithKeyCasingChange(JsonObject jsonObject, string key,
JsonNode
value)
734
private sealed class SchemaOrderJsonNodeConverter : JsonConverter<
JsonNode
>
738
public override bool CanConvert(Type typeToConvert) => typeof(
JsonNode
).IsAssignableFrom(typeToConvert) && typeToConvert != typeof(JsonValue);
740
public override void Write(Utf8JsonWriter writer,
JsonNode
? value, JsonSerializerOptions options)
747
IEnumerable<KeyValuePair<string,
JsonNode
>> properties =
761
foreach (
var
item in array)
776
public override
JsonNode
? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
ConfigurationSchemaGenerator.Tests (4)
GeneratorTests.cs (4)
1579
var
actualJson =
JsonNode
.Parse(actual)!;
1580
var
expectedJson =
JsonNode
.Parse(expected)!;
dotnet-user-jwts (1)
Helpers\SigningKeysHandler.cs (1)
85
var
toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (8)
UserJwtsTests.cs (8)
303
Assert.True(secretsJson.TryGetPropertyValue("Foo", out
var
fooField));
521
var
signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray());
524
Assert.True(secretsJson.TryGetPropertyValue("Foo", out
var
fooField));
549
var
signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray());
552
Assert.True(secretsJson.TryGetPropertyValue("Foo", out
var
fooField));
588
var
signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray());
631
var
signingKey1 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray());
635
var
signingKey2 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme-2")].AsArray());
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
ProblemDetailsJsonConverterTest.cs (1)
123
Assert.IsAssignableFrom<
JsonNode
>(kvp.Value!);
Microsoft.AspNetCore.Http.Extensions.Tests (5)
RequestDelegateFactoryTests.cs (2)
1387
var
deserializedResponseBody =
JsonNode
.Parse(responseBodyStream.ToArray());
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (3)
252
internal static async Task VerifyResponseJsonNodeAsync(HttpContext httpContext, Action<
JsonNode
> check, int expectedStatusCode = 200, string expectedContentType = "application/json; charset=utf-8")
255
var
node =
JsonNode
.Parse(body);
Microsoft.AspNetCore.Http.Microbenchmarks (3)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (3)
252
internal static async Task VerifyResponseJsonNodeAsync(HttpContext httpContext, Action<
JsonNode
> check, int expectedStatusCode = 200, string expectedContentType = "application/json; charset=utf-8")
255
var
node =
JsonNode
.Parse(body);
Microsoft.AspNetCore.OpenApi (25)
Extensions\JsonNodeSchemaExtensions.cs (20)
59
/// Note that this method targets <see cref="
JsonNode
"/> and not <see cref="OpenApiSchema"/> because it is
81
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
83
internal static void ApplyValidationAttributes(this
JsonNode
schema, IEnumerable<Attribute> validationAttributes)
148
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
151
internal static void ApplyDefaultValue(this
JsonNode
schema, object? defaultValue, JsonTypeInfo? jsonTypeInfo)
181
/// Note that this method targets <see cref="
JsonNode
"/> and not <see cref="OpenApiSchema"/> because
185
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
188
internal static void ApplyPrimitiveTypesAndFormats(this
JsonNode
schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId)
208
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
210
internal static void ApplyRouteConstraints(this
JsonNode
schema, IEnumerable<IRouteConstraint> constraints)
284
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
287
internal static void ApplyParameterInfo(this
JsonNode
schema, ApiParameterDescription parameterDescription, JsonTypeInfo? jsonTypeInfo)
355
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
358
internal static void MapPolymorphismOptionsToDiscriminator(this
JsonNode
schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId)
395
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
398
internal static void ApplySchemaReferenceId(this
JsonNode
schema, JsonSchemaExporterContext context, Func<JsonTypeInfo, string?> createSchemaReferenceId)
427
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
429
internal static void ApplyNullabilityContextInfo(this
JsonNode
schema, ParameterInfo parameterInfo)
447
/// <param name="schema">The <see cref="
JsonNode
"/> produced by the underlying schema generator.</param>
449
internal static void ApplyNullabilityContextInfo(this
JsonNode
schema, JsonPropertyInfo propertyInfo)
Schemas\OpenApiJsonSchema.Helpers.cs (3)
86
internal static
JsonNode
? ReadJsonNode(ref Utf8JsonReader reader)
89
internal static
JsonNode
? ReadJsonNode(ref Utf8JsonReader reader, out JsonSchemaType? type)
208
var enumValues = ReadList<
JsonNode
>(ref reader);
Schemas\OpenApiJsonSchemaContext.cs (1)
11
[JsonSerializable(typeof(
JsonNode
))]
Services\Schemas\OpenApiSchemaService.cs (1)
307
private
JsonNode
CreateSchema(OpenApiSchemaKey key)
Microsoft.AspNetCore.OpenApi.Tests (21)
Services\OpenApiSchemaService\OpenApiSchemaService.ParameterSchemas.cs (19)
160
[(int id = 2) => { }, (
JsonNode
defaultValue) => Assert.Equal(2, defaultValue.GetValue<int>())],
161
[(float id = 3f) => { }, (
JsonNode
defaultValue) => Assert.Equal(3, defaultValue.GetValue<int>())],
162
[(string id = "test") => { }, (
JsonNode
defaultValue) => Assert.Equal("test", defaultValue.GetValue<string>())],
163
[(bool id = true) => { }, (
JsonNode
defaultValue) => Assert.True(defaultValue.GetValue<bool>())],
164
[(TaskStatus status = TaskStatus.Canceled) => { }, (
JsonNode
defaultValue) => Assert.Equal(6, defaultValue.GetValue<int>())],
166
[(Status status = Status.Pending) => { }, (
JsonNode
defaultValue) => Assert.Equal("Pending", defaultValue.GetValue<string>())],
167
[([DefaultValue(2)] int id) => { }, (
JsonNode
defaultValue) => Assert.Equal(2, defaultValue.GetValue<int>())],
168
[([DefaultValue(3f)] float id) => { }, (
JsonNode
defaultValue) => Assert.Equal(3, defaultValue.GetValue<int>())],
169
[([DefaultValue("test")] string id) => { }, (
JsonNode
defaultValue) => Assert.Equal("test", defaultValue.GetValue<string>())],
170
[([DefaultValue(true)] bool id) => { }, (
JsonNode
defaultValue) => Assert.True(defaultValue.GetValue<bool>())],
171
[([DefaultValue(TaskStatus.Canceled)] TaskStatus status) => { }, (
JsonNode
defaultValue) => Assert.Equal(6, defaultValue.GetValue<int>())],
172
[([DefaultValue(Status.Pending)] Status status) => { }, (
JsonNode
defaultValue) => Assert.Equal("Pending", defaultValue.GetValue<string>())],
173
[([DefaultValue(null)] int? id) => { }, (
JsonNode
defaultValue) => Assert.True(defaultValue is null)],
174
[([DefaultValue(2)] int? id) => { }, (
JsonNode
defaultValue) => Assert.Equal(2, defaultValue.GetValue<int>())],
175
[([DefaultValue(null)] string? id) => { }, (
JsonNode
defaultValue) => Assert.True(defaultValue is null)],
176
[([DefaultValue("foo")] string? id) => { }, (
JsonNode
defaultValue) => Assert.Equal("foo", defaultValue.GetValue<string>())],
177
[([DefaultValue(null)] TaskStatus? status) => { }, (
JsonNode
defaultValue) => Assert.True(defaultValue is null)],
178
[([DefaultValue(TaskStatus.Canceled)] TaskStatus? status) => { }, (
JsonNode
defaultValue) => Assert.Equal(6, defaultValue.GetValue<int>())],
183
public async Task GetOpenApiParameters_HandlesRouteParametersWithDefaultValue(Delegate requestHandler, Action<
JsonNode
> assert)
Services\OpenApiSchemaService\OpenApiSchemaService.ResponseSchemas.cs (2)
655
var
defaultValue = Assert.IsAssignableFrom<
JsonNode
>(property.Value.Default);
Microsoft.Build.BuildCheck.UnitTests (3)
EndToEndTests.cs (3)
139
KeyValuePair<string,
JsonNode
?> resource = output.DepsJsonResources.FirstOrDefault(
142
resource.Equals(default(KeyValuePair<string,
JsonNode
?>)).ShouldBe(!isResourceExpected,
180
JsonNode
? depsJson = JsonObject.Parse(File.ReadAllText(depsFiles[0]));
Microsoft.Extensions.AI (8)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
216
private static
JsonNode
? JsonElementToJsonNode(JsonElement element)
ChatCompletion\OpenTelemetryChatClient.cs (2)
560
public
JsonNode
? Content { get; set; }
580
public
JsonNode
? Arguments { get; set; }
Functions\AIFunctionFactory.cs (5)
43
/// <see cref="JsonDocument"/>, or <see cref="
JsonNode
"/>, it is deserialized directly. If the argument is anything else unknown,
72
/// or <see cref="
JsonNode
"/>, it is deserialized directly. If the argument is anything else unknown, it is
115
/// <see cref="JsonDocument"/>, or <see cref="
JsonNode
"/>, it is deserialized directly. If the argument is anything else unknown,
150
/// or <see cref="
JsonNode
"/>, it is deserialized directly. If the argument is anything else unknown, it is
383
JsonNode
node => JsonSerializer.Deserialize(node, typeInfo),
Microsoft.Extensions.AI.Abstractions (56)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (15)
46
/// <returns>A new <see cref="
JsonNode
"/> instance defining the JSON schema for <paramref name="type"/>.</returns>
50
public 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>
70
public static
JsonNode
GetJsonSchemaAsNode(this JsonTypeInfo typeInfo, JsonSchemaExporterOptions? exporterOptions = null)
80
private static
JsonNode
MapRootTypeJsonSchema(JsonTypeInfo typeInfo, JsonSchemaExporterOptions exporterOptions)
153
JsonNode
discriminatorNode = discriminatorValue switch
155
string stringId => (
JsonNode
)stringId,
156
_ => (
JsonNode
)(int)discriminatorValue,
290
JsonNode
? defaultValue = null;
630
[typeof(
JsonNode
)] = _ => JsonSchema.CreateTrueSchema(),
669
new JsonSchema { Enum = new() { (
JsonNode
)"NaN", (
JsonNode
)"Infinity", (
JsonNode
)"-Infinity" } },
704
out
JsonNode
? defaultValue,
758
enumValues.Add((
JsonNode
)effectiveName);
src\Shared\JsonSchemaExporter\JsonSchemaExporter.JsonSchema.cs (14)
132
public
JsonNode
? Constant
142
private
JsonNode
? _constant;
240
public
JsonNode
? DefaultValue
250
private
JsonNode
? _defaultValue;
327
public
JsonNode
ToJsonNode(JsonSchemaExporterOptions options)
331
return CompleteSchema((
JsonNode
)boolSchema);
361
if (MapSchemaType(Type) is
JsonNode
type)
397
requiredArray.Add((
JsonNode
)requiredProperty);
441
objSchema.Add(JsonSchemaConstants.MinLengthPropertyName, (
JsonNode
)minLength);
446
objSchema.Add(JsonSchemaConstants.MaxLengthPropertyName, (
JsonNode
)maxLength);
451
JsonNode
CompleteSchema(
JsonNode
schema)
495
private static
JsonNode
? MapSchemaType(JsonSchemaType schemaType)
512
array.Add((
JsonNode
)ToIdentifier(type)!);
src\Shared\JsonSchemaExporter\JsonSchemaExporterOptions.cs (2)
36
public Func<JsonSchemaExporterContext,
JsonNode
,
JsonNode
>? TransformSchemaNode { get; init; }
Utilities\AIJsonSchemaCreateOptions.cs (2)
22
public Func<AIJsonSchemaCreateContext,
JsonNode
,
JsonNode
>? TransformSchemaNode { get; init; }
Utilities\AIJsonUtilities.Defaults.cs (1)
66
[JsonSerializable(typeof(
JsonNode
))]
Utilities\AIJsonUtilities.Schema.cs (22)
206
JsonNode
? defaultValueNode = key.DefaultValue is { } defaultValue
229
JsonNode
node = options.GetJsonSchemaAsNode(key.Type, exporterOptions);
232
JsonNode
TransformSchemaNode(JsonSchemaExporterContext schemaExporterContext,
JsonNode
schema)
250
ConvertSchemaToObject(ref schema).InsertAtStart(DescriptionPropertyName, (
JsonNode
)attr.Description);
258
if (key.ParameterName is not null && objSchema.TryGetPropertyValue(RefPropertyName, out
JsonNode
? paramName))
267
objSchema[RefPropertyName] = (
JsonNode
)refUri;
281
objSchema.Add(AdditionalPropertiesPropertyName, (
JsonNode
)false);
286
objSchema.TryGetPropertyValue(PropertiesPropertyName, out
JsonNode
? properties) &&
289
_ = objSchema.TryGetPropertyValue(RequiredPropertyName, out
JsonNode
? required);
292
requiredArray = [.. propertiesObj.Select(prop => (
JsonNode
)prop.Key)];
324
JsonNode
descriptionNode = (
JsonNode
)key.Description!;
329
obj.InsertAtStart(DescriptionPropertyName, (
JsonNode
)key.Description!);
334
obj[index] = (
JsonNode
)key.Description!;
340
JsonNode
? defaultValue = JsonSerializer.Serialize(key.DefaultValue, options.GetTypeInfo(typeof(object)));
347
ConvertSchemaToObject(ref schema).InsertAtStart(SchemaPropertyName, (
JsonNode
)SchemaKeywordUri);
359
static JsonObject ConvertSchemaToObject(ref
JsonNode
schema)
389
foreach (
JsonNode
? entry in typeArray)
412
private static void InsertAtStart(this JsonObject jsonObject, string key,
JsonNode
value)
485
public Func<AIJsonSchemaCreateContext,
JsonNode
,
JsonNode
>? TransformSchemaNode { get; }
Microsoft.Extensions.AI.Abstractions.Tests (23)
Contents\FunctionCallContentTests..cs (3)
86
var
json = JsonSerializer.SerializeToNode(sut, TestJsonSerializerContext.Default.Options);
176
var arguments = JsonSerializer.Deserialize<Dictionary<string,
JsonNode
>>("""
233
var arguments = JsonSerializer.Deserialize<Dictionary<string,
JsonNode
>>("""
test\Shared\JsonSchemaExporter\SchemaTestHelpers.cs (11)
17
public static void AssertEqualJsonSchema(
JsonNode
expectedJsonSchema,
JsonNode
actualJsonSchema)
19
if (!
JsonNode
.DeepEquals(expectedJsonSchema, actualJsonSchema))
31
public static void AssertDocumentMatchesSchema(
JsonNode
schema,
JsonNode
? instance)
52
public static void AssertDoesNotMatchSchema(
JsonNode
schema,
JsonNode
? instance)
67
private static EvaluationResults EvaluateSchemaCore(
JsonNode
schema,
JsonNode
? instance)
74
private static string FormatJson(
JsonNode
? node) =>
78
[JsonSerializable(typeof(
JsonNode
))]
test\Shared\JsonSchemaExporter\TestData.cs (3)
27
JsonNode
ITestData.ExpectedJsonSchema { get; } =
28
JsonNode
.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions)
58
JsonNode
ExpectedJsonSchema { get; }
test\Shared\JsonSchemaExporter\TestTypes.cs (3)
102
yield return new TestData<
JsonNode
>(
JsonNode
.Parse("""[{ "x" : 42 }]"""), "true");
1227
[JsonSerializable(typeof(
JsonNode
))]
TestJsonSerializerContext.cs (1)
25
[JsonSerializable(typeof(Dictionary<string,
JsonNode
>))] // Used in Content tests
Utilities\AIJsonUtilitiesTests.cs (2)
284
JsonNode
? schemaAsNode = JsonSerializer.SerializeToNode(schema, options);
296
JsonNode
? serializedValue = JsonSerializer.SerializeToNode(testData.Value, testData.Type, options);
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAISerializationTests.cs (6)
382
JsonObject parameterSchema = Assert.IsType<JsonObject>(
JsonNode
.Parse(Assert.IsType<JsonElement>(parameter.Schema).GetRawText()));
752
JsonNode
? expectedNode =
JsonNode
.Parse(expected);
753
JsonNode
? actualNode =
JsonNode
.Parse(actual);
755
if (!
JsonNode
.DeepEquals(expectedNode, actualNode))
Microsoft.Extensions.AI.Tests (1)
TestJsonSerializerContext.cs (1)
23
[JsonSerializable(typeof(Dictionary<string,
JsonNode
>))]
Microsoft.ML.AutoML (12)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (3)
17
var
jValue = JsonValue.Parse(ref reader);
26
var
jsonObject =
JsonNode
.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
18
var
jsonObject = JsonValue.Parse(ref reader);
29
var
jObject = JsonObject.Parse("{}");
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (4)
17
var
jNode =
JsonNode
.Parse(ref reader);
29
var
jNode =
JsonNode
.Parse("{}");
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
17
var
jValue = JsonValue.Parse(ref reader);
27
var
jsonObject =
JsonNode
.Parse("{}");
Microsoft.ML.AutoML.SourceGenerator (5)
SearchSpaceGenerator.cs (5)
35
var searchSpacesJNodes = searchSpacesJson.Select(x =>
JsonNode
.Parse(x));
37
foreach (
var
jNode in searchSpacesJNodes)
65
var
defaultToken = t.AsObject().ContainsKey("default") ? t["default"] : null;
86
var
searchSpaceNode = t.AsObject().ContainsKey("search_space") ? t["search_space"] : null;
96
var
minToken = searchSpaceNode["min"];
MSBuild (3)
JsonOutputFormatter.cs (3)
21
private readonly
JsonNode
_topLevelNode = new JsonObject();
37
JsonNode
propertiesNode = new JsonObject();
55
JsonNode
itemsNode = new JsonObject();
Roslyn.VisualStudio.Next.UnitTests (9)
UnifiedSettings\UnifiedSettingsTests.cs (9)
133
var
jsonDocument = await
JsonNode
.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip });
147
var
jsonDocument = await
JsonNode
.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip });
235
var
jsonDocument = await
JsonNode
.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip });
249
var
jsonDocument = await
JsonNode
.ParseAsync(registrationFileStream!, documentOptions: new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip });
259
private static void VerifyProperties(
JsonNode
jsonDocument, string prefix, ImmutableArray<(IOption2, UnifiedSettingBase)> expectedOptionToSettings)
Shared.Tests (27)
JsonSchemaExporter\JsonSchemaExporterTests.cs (10)
34
JsonNode
schema = options.GetJsonSchemaAsNode(testData.Type, (JsonSchemaExporterOptions?)testData.ExporterOptions);
46
JsonNode
schema = options.GetJsonSchemaAsNode(testData.Type, (JsonSchemaExporterOptions?)testData.ExporterOptions);
47
JsonNode
? instance = JsonSerializer.SerializeToNode(testData.Value, testData.Type, options);
60
JsonNode
schema = Options.GetJsonSchemaAsNode(referenceType, config);
76
JsonNode
schema = Options.GetJsonSchemaAsNode(referenceType, config);
85
JsonNode
schema = Options.GetJsonSchemaAsNode(typeof(XElement));
126
JsonNode
schema = Options.GetJsonSchemaAsNode(typeof(object), config);
133
JsonNode
schema = Options.GetJsonSchemaAsNode(typeof(TestTypes.PocoDisallowingUnmappedMembers));
134
JsonNode
? jsonWithUnmappedProperties =
JsonNode
.Parse("""{ "UnmappedProperty" : {} }""");
JsonSchemaExporter\SchemaTestHelpers.cs (11)
17
public static void AssertEqualJsonSchema(
JsonNode
expectedJsonSchema,
JsonNode
actualJsonSchema)
19
if (!
JsonNode
.DeepEquals(expectedJsonSchema, actualJsonSchema))
31
public static void AssertDocumentMatchesSchema(
JsonNode
schema,
JsonNode
? instance)
52
public static void AssertDoesNotMatchSchema(
JsonNode
schema,
JsonNode
? instance)
67
private static EvaluationResults EvaluateSchemaCore(
JsonNode
schema,
JsonNode
? instance)
74
private static string FormatJson(
JsonNode
? node) =>
78
[JsonSerializable(typeof(
JsonNode
))]
JsonSchemaExporter\TestData.cs (3)
27
JsonNode
ITestData.ExpectedJsonSchema { get; } =
28
JsonNode
.Parse(ExpectedJsonSchema, documentOptions: _schemaParseOptions)
58
JsonNode
ExpectedJsonSchema { get; }
JsonSchemaExporter\TestTypes.cs (3)
102
yield return new TestData<
JsonNode
>(
JsonNode
.Parse("""[{ "x" : 42 }]"""), "true");
1227
[JsonSerializable(typeof(
JsonNode
))]
System.Text.Json (465)
System\Text\Json\Nodes\JsonArray.cs (31)
24
private List<
JsonNode
?>? _list;
39
public JsonArray(JsonNodeOptions options, params
JsonNode
?[] items) : base(options)
49
public JsonArray(JsonNodeOptions options, params ReadOnlySpan<
JsonNode
?> items) : base(options)
58
public JsonArray(params
JsonNode
?[] items) : base()
67
public JsonArray(params ReadOnlySpan<
JsonNode
?> items) : base()
74
internal override
JsonNode
DeepCloneCore()
76
GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement);
87
_list = new List<
JsonNode
?>(list.Count)
98
internal override bool DeepEqualsCore(
JsonNode
node)
108
List<
JsonNode
?> currentList = List;
109
List<
JsonNode
?> otherList = array.List;
131
internal int GetElementIndex(
JsonNode
? node)
137
/// Returns an enumerable that wraps calls to <see cref="
JsonNode
.GetValue{T}"/>.
143
foreach (
JsonNode
? item in List)
149
private void InitializeFromArray(
JsonNode
?[] items)
151
var list = new List<
JsonNode
?>(items);
161
private void InitializeFromSpan(ReadOnlySpan<
JsonNode
?> items)
163
List<
JsonNode
?> list = new(items.Length);
220
JsonNode
? nodeToAdd = ConvertFromValue(value, Options);
227
private List<
JsonNode
?> List => _list ?? InitializeList();
229
private protected override
JsonNode
? GetItem(int index)
234
private protected override void SetItem(int index,
JsonNode
? value)
241
internal override void GetPath(ref ValueStringBuilder path,
JsonNode
? child)
271
GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement);
281
foreach (
JsonNode
? element in List)
297
private List<
JsonNode
?> InitializeList()
299
GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement);
308
list = new List<
JsonNode
?>(jElement.GetArrayLength());
312
JsonNode
? node = JsonNodeConverter.Create(element, Options);
335
private void GetUnderlyingRepresentation(out List<
JsonNode
?>? list, out JsonElement? jsonElement)
379
public
JsonNode
? Value;
System\Text\Json\Nodes\JsonArray.IList.cs (21)
17
/// Adds a <see cref="
JsonNode
"/> to the end of the <see cref="JsonArray"/>.
20
/// The <see cref="
JsonNode
"/> to be added to the end of the <see cref="JsonArray"/>.
22
public void Add(
JsonNode
? item)
34
List<
JsonNode
?>? list = _list;
58
public bool Contains(
JsonNode
? item) => List.Contains(item);
63
/// <param name="item">The <see cref="
JsonNode
"/> to locate in the <see cref="JsonArray"/>.</param>
67
public int IndexOf(
JsonNode
? item) => List.IndexOf(item);
73
/// <param name="item">The <see cref="
JsonNode
"/> to insert.</param>
77
public void Insert(int index,
JsonNode
? item)
84
/// Removes the first occurrence of a specific <see cref="
JsonNode
"/> from the <see cref="JsonArray"/>.
87
/// The <see cref="
JsonNode
"/> to remove from the <see cref="JsonArray"/>.
92
public bool Remove(
JsonNode
? item)
112
JsonNode
? item = List[index];
125
public int RemoveAll(Func<
JsonNode
?, bool> match)
169
List<
JsonNode
?> list = List;
211
void ICollection<
JsonNode
?>.CopyTo(
JsonNode
?[] array, int index) => List.CopyTo(array, index);
216
/// <returns>A <see cref="IEnumerator{JsonNode}"/> for the <see cref="
JsonNode
"/>.</returns>
217
public IEnumerator<
JsonNode
?> GetEnumerator() => List.GetEnumerator();
230
bool ICollection<
JsonNode
?>.IsReadOnly => false;
234
private static void DetachParent(
JsonNode
? item)
System\Text\Json\Nodes\JsonNode.cs (30)
14
/// declared as an <see cref="object"/> should be deserialized as a <see cref="
JsonNode
"/>.
20
private
JsonNode
? _parent;
116
/// Gets the parent <see cref="
JsonNode
"/>.
120
public
JsonNode
? Parent
149
internal abstract void GetPath(ref ValueStringBuilder path,
JsonNode
? child);
152
/// Gets the root <see cref="
JsonNode
"/>.
157
public
JsonNode
Root
161
JsonNode
? parent = Parent;
191
/// The current <see cref="
JsonNode
"/> cannot be represented as a {T}.
194
/// The current <see cref="
JsonNode
"/> is not a <see cref="JsonValue"/> or
208
/// The current <see cref="
JsonNode
"/> is not a <see cref="JsonArray"/> or <see cref="JsonObject"/>.
210
public
JsonNode
? this[int index]
216
private protected virtual
JsonNode
? GetItem(int index)
222
private protected virtual void SetItem(int index,
JsonNode
? node) =>
234
/// The current <see cref="
JsonNode
"/> is not a <see cref="JsonObject"/>.
236
public
JsonNode
? this[string propertyName]
249
/// Creates a new instance of the <see cref="
JsonNode
"/>. All children nodes are recursively cloned.
252
public
JsonNode
DeepClone() => DeepCloneCore();
254
internal abstract
JsonNode
DeepCloneCore();
302
/// <param name="node1">The <see cref="
JsonNode
"/> to compare.</param>
303
/// <param name="node2">The <see cref="
JsonNode
"/> to compare.</param>
305
public static bool DeepEquals(
JsonNode
? node1,
JsonNode
? node2)
319
internal abstract bool DeepEqualsCore(
JsonNode
node);
330
JsonNode
? node;
344
internal void AssignParent(
JsonNode
parent)
351
JsonNode
? p = parent;
367
/// to support arbitrary <see cref="JsonElement"/> and <see cref="
JsonNode
"/> values.
372
internal static
JsonNode
? ConvertFromValue<T>(T? value, JsonNodeOptions? options = null)
379
if (value is
JsonNode
node)
System\Text\Json\Nodes\JsonNode.Operators.cs (198)
11
/// Defines an implicit conversion of a given <see cref="bool"/> to a <see cref="
JsonNode
"/>.
14
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
15
public static implicit operator
JsonNode
(bool value) => JsonValue.Create(value);
18
/// Defines an implicit conversion of a given <see cref="bool"/> to a <see cref="
JsonNode
"/>.
21
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
22
public static implicit operator
JsonNode
?(bool? value) => JsonValue.Create(value);
25
/// Defines an implicit conversion of a given <see cref="byte"/> to a <see cref="
JsonNode
"/>.
28
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
29
public static implicit operator
JsonNode
(byte value) => JsonValue.Create(value);
32
/// Defines an implicit conversion of a given <see cref="byte"/> to a <see cref="
JsonNode
"/>.
35
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
36
public static implicit operator
JsonNode
?(byte? value) => JsonValue.Create(value);
39
/// Defines an implicit conversion of a given <see cref="char"/> to a <see cref="
JsonNode
"/>.
42
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
43
public static implicit operator
JsonNode
(char value) => JsonValue.Create(value);
46
/// Defines an implicit conversion of a given <see cref="char"/> to a <see cref="
JsonNode
"/>.
49
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
50
public static implicit operator
JsonNode
?(char? value) => JsonValue.Create(value);
53
/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="
JsonNode
"/>.
56
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
57
public static implicit operator
JsonNode
(DateTime value) => JsonValue.Create(value);
60
/// Defines an implicit conversion of a given <see cref="DateTime"/> to a <see cref="
JsonNode
"/>.
63
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
64
public static implicit operator
JsonNode
?(DateTime? value) => JsonValue.Create(value);
67
/// Defines an implicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="
JsonNode
"/>.
70
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
71
public static implicit operator
JsonNode
(DateTimeOffset value) => JsonValue.Create(value);
74
/// Defines an implicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="
JsonNode
"/>.
77
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
78
public static implicit operator
JsonNode
?(DateTimeOffset? value) => JsonValue.Create(value);
81
/// Defines an implicit conversion of a given <see cref="decimal"/> to a <see cref="
JsonNode
"/>.
84
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
85
public static implicit operator
JsonNode
(decimal value) => JsonValue.Create(value);
88
/// Defines an implicit conversion of a given <see cref="decimal"/> to a <see cref="
JsonNode
"/>.
91
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
92
public static implicit operator
JsonNode
?(decimal? value) => JsonValue.Create(value);
95
/// Defines an implicit conversion of a given <see cref="double"/> to a <see cref="
JsonNode
"/>.
98
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
99
public static implicit operator
JsonNode
(double value) => JsonValue.Create(value);
102
/// Defines an implicit conversion of a given <see cref="double"/> to a <see cref="
JsonNode
"/>.
105
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
106
public static implicit operator
JsonNode
?(double? value) => JsonValue.Create(value);
109
/// Defines an implicit conversion of a given <see cref="Guid"/> to a <see cref="
JsonNode
"/>.
112
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
113
public static implicit operator
JsonNode
(Guid value) => JsonValue.Create(value);
116
/// Defines an implicit conversion of a given <see cref="Guid"/> to a <see cref="
JsonNode
"/>.
119
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
120
public static implicit operator
JsonNode
?(Guid? value) => JsonValue.Create(value);
123
/// Defines an implicit conversion of a given <see cref="short"/> to a <see cref="
JsonNode
"/>.
126
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
127
public static implicit operator
JsonNode
(short value) => JsonValue.Create(value);
130
/// Defines an implicit conversion of a given <see cref="short"/> to a <see cref="
JsonNode
"/>.
133
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
134
public static implicit operator
JsonNode
?(short? value) => JsonValue.Create(value);
137
/// Defines an implicit conversion of a given <see cref="int"/> to a <see cref="
JsonNode
"/>.
140
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
141
public static implicit operator
JsonNode
(int value) => JsonValue.Create(value);
144
/// Defines an implicit conversion of a given <see cref="int"/> to a <see cref="
JsonNode
"/>.
147
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
148
public static implicit operator
JsonNode
?(int? value) => JsonValue.Create(value);
151
/// Defines an implicit conversion of a given <see cref="long"/> to a <see cref="
JsonNode
"/>.
154
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
155
public static implicit operator
JsonNode
(long value) => JsonValue.Create(value);
158
/// Defines an implicit conversion of a given <see cref="long"/> to a <see cref="
JsonNode
"/>.
161
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
162
public static implicit operator
JsonNode
?(long? value) => JsonValue.Create(value);
165
/// Defines an implicit conversion of a given <see cref="sbyte"/> to a <see cref="
JsonNode
"/>.
168
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
170
public static implicit operator
JsonNode
(sbyte value) => JsonValue.Create(value);
173
/// Defines an implicit conversion of a given <see cref="sbyte"/> to a <see cref="
JsonNode
"/>.
176
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
178
public static implicit operator
JsonNode
?(sbyte? value) => JsonValue.Create(value);
181
/// Defines an implicit conversion of a given <see cref="float"/> to a <see cref="
JsonNode
"/>.
184
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
185
public static implicit operator
JsonNode
(float value) => JsonValue.Create(value);
188
/// Defines an implicit conversion of a given <see cref="float"/> to a <see cref="
JsonNode
"/>.
191
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
192
public static implicit operator
JsonNode
?(float? value) => JsonValue.Create(value);
195
/// Defines an implicit conversion of a given <see cref="string"/> to a <see cref="
JsonNode
"/>.
198
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
200
public static implicit operator
JsonNode
?(string? value) => JsonValue.Create(value);
203
/// Defines an implicit conversion of a given <see cref="ushort"/> to a <see cref="
JsonNode
"/>.
206
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
208
public static implicit operator
JsonNode
(ushort value) => JsonValue.Create(value);
211
/// Defines an implicit conversion of a given <see cref="ushort"/> to a <see cref="
JsonNode
"/>.
214
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
216
public static implicit operator
JsonNode
?(ushort? value) => JsonValue.Create(value);
219
/// Defines an implicit conversion of a given <see cref="uint"/> to a <see cref="
JsonNode
"/>.
222
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
224
public static implicit operator
JsonNode
(uint value) => JsonValue.Create(value);
227
/// Defines an implicit conversion of a given <see cref="uint"/> to a <see cref="
JsonNode
"/>.
230
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
232
public static implicit operator
JsonNode
?(uint? value) => JsonValue.Create(value);
235
/// Defines an implicit conversion of a given <see cref="ulong"/> to a <see cref="
JsonNode
"/>.
238
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
240
public static implicit operator
JsonNode
(ulong value) => JsonValue.Create(value);
243
/// Defines an implicit conversion of a given <see cref="ulong"/> to a <see cref="
JsonNode
"/>.
246
/// <returns>A <see cref="
JsonNode
"/> instance converted from the <paramref name="value"/> parameter.</returns>
248
public static implicit operator
JsonNode
?(ulong? value) => JsonValue.Create(value);
251
/// Defines an explicit conversion of a given <see cref="bool"/> to a <see cref="
JsonNode
"/>.
254
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
255
public static explicit operator bool(
JsonNode
value) => value.GetValue<bool>();
258
/// Defines an explicit conversion of a given <see cref="bool"/> to a <see cref="
JsonNode
"/>.
261
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
262
public static explicit operator bool?(
JsonNode
? value) => value?.GetValue<bool>();
265
/// Defines an explicit conversion of a given <see cref="byte"/> to a <see cref="
JsonNode
"/>.
268
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
269
public static explicit operator byte(
JsonNode
value) => value.GetValue<byte>();
272
/// Defines an explicit conversion of a given <see cref="byte"/> to a <see cref="
JsonNode
"/>.
275
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
276
public static explicit operator byte?(
JsonNode
? value) => value?.GetValue<byte>();
279
/// Defines an explicit conversion of a given <see cref="char"/> to a <see cref="
JsonNode
"/>.
282
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
283
public static explicit operator char(
JsonNode
value) => value.GetValue<char>();
286
/// Defines an explicit conversion of a given <see cref="char"/> to a <see cref="
JsonNode
"/>.
289
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
290
public static explicit operator char?(
JsonNode
? value) => value?.GetValue<char>();
293
/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="
JsonNode
"/>.
296
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
297
public static explicit operator DateTime(
JsonNode
value) => value.GetValue<DateTime>();
300
/// Defines an explicit conversion of a given <see cref="DateTime"/> to a <see cref="
JsonNode
"/>.
303
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
304
public static explicit operator DateTime?(
JsonNode
? value) => value?.GetValue<DateTime>();
307
/// Defines an explicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="
JsonNode
"/>.
310
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
311
public static explicit operator DateTimeOffset(
JsonNode
value) => value.GetValue<DateTimeOffset>();
314
/// Defines an explicit conversion of a given <see cref="DateTimeOffset"/> to a <see cref="
JsonNode
"/>.
317
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
318
public static explicit operator DateTimeOffset?(
JsonNode
? value) => value?.GetValue<DateTimeOffset>();
321
/// Defines an explicit conversion of a given <see cref="decimal"/> to a <see cref="
JsonNode
"/>.
324
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
325
public static explicit operator decimal(
JsonNode
value) => value.GetValue<decimal>();
328
/// Defines an explicit conversion of a given <see cref="decimal"/> to a <see cref="
JsonNode
"/>.
331
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
332
public static explicit operator decimal?(
JsonNode
? value) => value?.GetValue<decimal>();
335
/// Defines an explicit conversion of a given <see cref="double"/> to a <see cref="
JsonNode
"/>.
338
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
339
public static explicit operator double(
JsonNode
value) => value.GetValue<double>();
342
/// Defines an explicit conversion of a given <see cref="double"/> to a <see cref="
JsonNode
"/>.
345
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
346
public static explicit operator double?(
JsonNode
? value) => value?.GetValue<double>();
349
/// Defines an explicit conversion of a given <see cref="Guid"/> to a <see cref="
JsonNode
"/>.
352
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
353
public static explicit operator Guid(
JsonNode
value) => value.GetValue<Guid>();
356
/// Defines an explicit conversion of a given <see cref="Guid"/> to a <see cref="
JsonNode
"/>.
359
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
360
public static explicit operator Guid?(
JsonNode
? value) => value?.GetValue<Guid>();
363
/// Defines an explicit conversion of a given <see cref="short"/> to a <see cref="
JsonNode
"/>.
366
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
367
public static explicit operator short(
JsonNode
value) => value.GetValue<short>();
370
/// Defines an explicit conversion of a given <see cref="short"/> to a <see cref="
JsonNode
"/>.
373
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
374
public static explicit operator short?(
JsonNode
? value) => value?.GetValue<short>();
377
/// Defines an explicit conversion of a given <see cref="int"/> to a <see cref="
JsonNode
"/>.
380
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
381
public static explicit operator int(
JsonNode
value) => value.GetValue<int>();
384
/// Defines an explicit conversion of a given <see cref="int"/> to a <see cref="
JsonNode
"/>.
387
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
388
public static explicit operator int?(
JsonNode
? value) => value?.GetValue<int>();
391
/// Defines an explicit conversion of a given <see cref="long"/> to a <see cref="
JsonNode
"/>.
394
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
395
public static explicit operator long(
JsonNode
value) => value.GetValue<long>();
398
/// Defines an explicit conversion of a given <see cref="long"/> to a <see cref="
JsonNode
"/>.
401
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
402
public static explicit operator long?(
JsonNode
? value) => value?.GetValue<long>();
405
/// Defines an explicit conversion of a given <see cref="sbyte"/> to a <see cref="
JsonNode
"/>.
408
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
410
public static explicit operator sbyte(
JsonNode
value) => value.GetValue<sbyte>();
413
/// Defines an explicit conversion of a given <see cref="sbyte"/> to a <see cref="
JsonNode
"/>.
416
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
418
public static explicit operator sbyte?(
JsonNode
? value) => value?.GetValue<sbyte>();
421
/// Defines an explicit conversion of a given <see cref="float"/> to a <see cref="
JsonNode
"/>.
424
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
425
public static explicit operator float(
JsonNode
value) => value.GetValue<float>();
428
/// Defines an explicit conversion of a given <see cref="float"/> to a <see cref="
JsonNode
"/>.
431
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
432
public static explicit operator float?(
JsonNode
? value) => value?.GetValue<float>();
435
/// Defines an explicit conversion of a given <see cref="string"/> to a <see cref="
JsonNode
"/>.
438
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
439
public static explicit operator string?(
JsonNode
? value) => value?.GetValue<string>();
442
/// Defines an explicit conversion of a given <see cref="ushort"/> to a <see cref="
JsonNode
"/>.
445
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
447
public static explicit operator ushort(
JsonNode
value) => value.GetValue<ushort>();
450
/// Defines an explicit conversion of a given <see cref="ushort"/> to a <see cref="
JsonNode
"/>.
453
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
455
public static explicit operator ushort?(
JsonNode
? value) => value?.GetValue<ushort>();
458
/// Defines an explicit conversion of a given <see cref="uint"/> to a <see cref="
JsonNode
"/>.
461
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
463
public static explicit operator uint(
JsonNode
value) => value.GetValue<uint>();
466
/// Defines an explicit conversion of a given <see cref="uint"/> to a <see cref="
JsonNode
"/>.
469
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
471
public static explicit operator uint?(
JsonNode
? value) => value?.GetValue<uint>();
474
/// Defines an explicit conversion of a given <see cref="ulong"/> to a <see cref="
JsonNode
"/>.
477
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
479
public static explicit operator ulong(
JsonNode
value) => value.GetValue<ulong>();
482
/// Defines an explicit conversion of a given <see cref="ulong"/> to a <see cref="
JsonNode
"/>.
485
/// <returns>A value converted from the <see cref="
JsonNode
"/> instance.</returns>
487
public static explicit operator ulong?(
JsonNode
? value) => value?.GetValue<ulong>();
System\Text\Json\Nodes\JsonNode.Parse.cs (12)
20
/// The <see cref="
JsonNode
"/> from the reader.
47
public static
JsonNode
? Parse(
62
/// A <see cref="
JsonNode
"/> representation of the JSON value.
70
public static
JsonNode
? Parse(
91
/// A <see cref="
JsonNode
"/> representation of the JSON value.
96
public static
JsonNode
? Parse(
107
/// <see cref="
JsonNode
"/>. The Stream will be read to completion.
113
/// A <see cref="
JsonNode
"/> representation of the JSON value.
118
public static
JsonNode
? Parse(
134
/// <see cref="
JsonNode
"/>. The Stream will be read to completion.
141
/// A <see cref="Task"/> to produce a <see cref="
JsonNode
"/> representation of the JSON value.
146
public static async Task<
JsonNode
?> ParseAsync(
System\Text\Json\Nodes\JsonNode.To.cs (1)
72
/// 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 (32)
36
public JsonObject(IEnumerable<KeyValuePair<string,
JsonNode
?>> properties, JsonNodeOptions? options = null) : this(options)
38
int capacity = properties is ICollection<KeyValuePair<string,
JsonNode
?>> propertiesCollection ? propertiesCollection.Count : 0;
39
OrderedDictionary<string,
JsonNode
?> dictionary = CreateDictionary(options, capacity);
41
foreach (KeyValuePair<string,
JsonNode
?> node in properties)
78
private OrderedDictionary<string,
JsonNode
?> Dictionary => _dictionary ?? InitializeDictionary();
80
private protected override
JsonNode
? GetItem(int index) => GetAt(index).Value;
81
private protected override void SetItem(int index,
JsonNode
? value) => SetAt(index, value);
83
internal override
JsonNode
DeepCloneCore()
85
GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement);
99
foreach (KeyValuePair<string,
JsonNode
?> item in dictionary)
107
internal string GetPropertyName(
JsonNode
? node)
109
KeyValuePair<string,
JsonNode
?>? item = FindValue(node);
121
public bool TryGetPropertyValue(string propertyName, out
JsonNode
? jsonNode)
139
GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement);
150
foreach (KeyValuePair<string,
JsonNode
?> entry in Dictionary)
170
internal override bool DeepEqualsCore(
JsonNode
node)
180
OrderedDictionary<string,
JsonNode
?> currentDict = Dictionary;
181
OrderedDictionary<string,
JsonNode
?> otherDict = jsonObject.Dictionary;
188
foreach (KeyValuePair<string,
JsonNode
?> item in currentDict)
190
otherDict.TryGetValue(item.Key, out
JsonNode
? jsonNode);
205
internal
JsonNode
? GetItem(string propertyName)
212
if (TryGetPropertyValue(propertyName, out
JsonNode
? value))
221
internal override void GetPath(ref ValueStringBuilder path,
JsonNode
? child)
242
internal void SetItem(string propertyName,
JsonNode
? value)
249
OrderedDictionary<string,
JsonNode
?> dict = Dictionary;
263
JsonNode
? replacedValue = dict.GetAt(index).Value;
277
private void DetachParent(
JsonNode
? item)
287
private KeyValuePair<string,
JsonNode
?>? FindValue(
JsonNode
? value)
289
foreach (KeyValuePair<string,
JsonNode
?> item in Dictionary)
322
foreach (KeyValuePair<string,
JsonNode
?> item in _node)
337
public
JsonNode
? Value;
System\Text\Json\Nodes\JsonObject.IDictionary.cs (27)
13
private OrderedDictionary<string,
JsonNode
?>? _dictionary;
26
public void Add(string propertyName,
JsonNode
? value)
49
public void Add(KeyValuePair<string,
JsonNode
?> property) => Add(property.Key, property.Value);
56
OrderedDictionary<string,
JsonNode
?>? dictionary = _dictionary;
64
foreach (
JsonNode
? node in dictionary.Values)
114
bool success = Dictionary.Remove(propertyName, out
JsonNode
? removedNode);
124
/// Determines whether the <see cref="JsonObject"/> contains a specific property name and <see cref="
JsonNode
"/> reference.
130
bool ICollection<KeyValuePair<string,
JsonNode
?>>.Contains(KeyValuePair<string,
JsonNode
?> item) =>
131
((IDictionary<string,
JsonNode
?>)Dictionary).Contains(item);
150
void ICollection<KeyValuePair<string,
JsonNode
?>>.CopyTo(KeyValuePair<string,
JsonNode
?>[] array, int index) =>
151
((IDictionary<string,
JsonNode
?>)Dictionary).CopyTo(array, index);
159
public IEnumerator<KeyValuePair<string,
JsonNode
?>> GetEnumerator() => Dictionary.GetEnumerator();
170
bool ICollection<KeyValuePair<string,
JsonNode
?>>.Remove(KeyValuePair<string,
JsonNode
?> item) => Remove(item.Key);
175
ICollection<string> IDictionary<string,
JsonNode
?>.Keys => Dictionary.Keys;
180
ICollection<
JsonNode
?> IDictionary<string,
JsonNode
?>.Values => Dictionary.Values;
196
bool IDictionary<string,
JsonNode
?>.TryGetValue(string propertyName, out
JsonNode
? jsonNode)
209
bool ICollection<KeyValuePair<string,
JsonNode
?>>.IsReadOnly => false;
219
private OrderedDictionary<string,
JsonNode
?> InitializeDictionary()
221
GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement);
231
JsonNode
? node = JsonNodeConverter.Create(jElementProperty.Value, Options);
250
private static OrderedDictionary<string,
JsonNode
?> CreateDictionary(JsonNodeOptions? options, int capacity = 0)
263
private void GetUnderlyingRepresentation(out OrderedDictionary<string,
JsonNode
?>? dictionary, out JsonElement? jsonElement)
System\Text\Json\Nodes\JsonObject.IList.cs (17)
15
public KeyValuePair<string,
JsonNode
?> GetAt(int index) => Dictionary.GetAt(index);
24
public void SetAt(int index, string propertyName,
JsonNode
? value)
31
OrderedDictionary<string,
JsonNode
?> dictionary = Dictionary;
32
KeyValuePair<string,
JsonNode
?> existing = dictionary.GetAt(index);
43
public void SetAt(int index,
JsonNode
? value)
45
OrderedDictionary<string,
JsonNode
?> dictionary = Dictionary;
46
KeyValuePair<string,
JsonNode
?> existing = dictionary.GetAt(index);
73
public void Insert(int index, string propertyName,
JsonNode
? value)
89
KeyValuePair<string,
JsonNode
?> existing = Dictionary.GetAt(index);
95
KeyValuePair<string,
JsonNode
?> IList<KeyValuePair<string,
JsonNode
?>>.this[int index]
102
int IList<KeyValuePair<string,
JsonNode
?>>.IndexOf(KeyValuePair<string,
JsonNode
?> item) => ((IList<KeyValuePair<string,
JsonNode
?>>)Dictionary).IndexOf(item);
105
void IList<KeyValuePair<string,
JsonNode
?>>.Insert(int index, KeyValuePair<string,
JsonNode
?> item) => Insert(index, item.Key, item.Value);
108
void IList<KeyValuePair<string,
JsonNode
?>>.RemoveAt(int index) => RemoveAt(index);
System\Text\Json\Nodes\JsonValue.cs (6)
32
/// <seealso cref="
JsonNode
.GetValue{T}"></seealso>
57
if (value is
JsonNode
)
94
if (value is
JsonNode
)
109
internal override bool DeepEqualsCore(
JsonNode
otherNode)
129
static JsonElement ToJsonElement(
JsonNode
node, out JsonDocument? backingDocument)
157
internal sealed override void GetPath(ref ValueStringBuilder path,
JsonNode
? child)
System\Text\Json\Nodes\JsonValueOfElement.cs (2)
20
internal override
JsonNode
DeepCloneCore() => new JsonValueOfElement(Value.Clone(), Options);
23
internal override bool DeepEqualsCore(
JsonNode
otherNode)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
19
Debug.Assert(value is not
JsonNode
);
System\Text\Json\Nodes\JsonValueOfTCustomized.cs (1)
27
internal override
JsonNode
DeepCloneCore() => JsonSerializer.SerializeToNode(Value, _jsonTypeInfo)!;
System\Text\Json\Nodes\JsonValueOfTPrimitive.cs (2)
28
internal override
JsonNode
DeepCloneCore() => new JsonValuePrimitive<TValue>(Value, _converter, Options);
30
internal override bool DeepEqualsCore(
JsonNode
otherNode)
System\Text\Json\Schema\JsonSchema.cs (14)
62
public
JsonNode
? Constant { get => _constant; set { VerifyMutable(); _constant = value; } }
63
private
JsonNode
? _constant;
89
public
JsonNode
? DefaultValue { get => _defaultValue; set { VerifyMutable(); _defaultValue = value; } }
90
private
JsonNode
? _defaultValue;
151
public
JsonNode
ToJsonNode(JsonSchemaExporterOptions options)
155
return CompleteSchema((
JsonNode
)boolSchema);
170
if (MapSchemaType(Type) is
JsonNode
type)
206
requiredArray.Add((
JsonNode
)requiredProperty);
250
objSchema.Add(MinLengthPropertyName, (
JsonNode
)minLength);
255
objSchema.Add(MaxLengthPropertyName, (
JsonNode
)maxLength);
260
JsonNode
CompleteSchema(
JsonNode
schema)
312
public static
JsonNode
? MapSchemaType(JsonSchemaType schemaType)
329
array.Add((
JsonNode
)ToIdentifier(type)!);
System\Text\Json\Schema\JsonSchemaExporter.cs (7)
21
/// Gets the JSON schema for <paramref name="type"/> as a <see cref="
JsonNode
"/> document.
27
public static
JsonNode
GetJsonSchemaAsNode(this JsonSerializerOptions options, Type type, JsonSchemaExporterOptions? exporterOptions = null)
45
/// Gets the JSON schema for <paramref name="typeInfo"/> as a <see cref="
JsonNode
"/> document.
50
public static
JsonNode
GetJsonSchemaAsNode(this JsonTypeInfo typeInfo, JsonSchemaExporterOptions? exporterOptions = null)
124
JsonNode
discriminatorNode = discriminatorValue switch
126
string stringId => (
JsonNode
)stringId,
127
_ => (
JsonNode
)(int)discriminatorValue,
System\Text\Json\Schema\JsonSchemaExporterOptions.cs (2)
31
public Func<JsonSchemaExporterContext,
JsonNode
,
JsonNode
>? TransformSchemaNode { get; init; }
System\Text\Json\Serialization\Attributes\JsonExtensionDataAttribute.cs (1)
16
/// <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\JsonNodeConverter.cs (5)
15
internal sealed class JsonNodeConverter : JsonConverter<
JsonNode
?>
27
public override void Write(Utf8JsonWriter writer,
JsonNode
? value, JsonSerializerOptions options)
39
public override
JsonNode
? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
60
public static
JsonNode
? Create(JsonElement element, JsonNodeOptions? options)
62
JsonNode
? node;
System\Text\Json\Serialization\Converters\Node\JsonNodeConverterFactory.cs (2)
29
Debug.Assert(typeof(
JsonNode
) == typeToConvert);
33
public override bool CanConvert(Type typeToConvert) => typeof(
JsonNode
).IsAssignableFrom(typeToConvert);
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (4)
25
bool success = JsonNodeConverter.Instance.TryRead(ref reader, typeof(
JsonNode
), options, ref state, out
JsonNode
? value, out _);
31
Debug.Assert(value == null || value is
JsonNode
);
32
JsonNode
? jNodeValue = value;
System\Text\Json\Serialization\Converters\Object\ObjectConverter.cs (1)
135
JsonNode
? node = JsonNodeConverter.Instance.Read(ref reader, typeToConvert, options);
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (1)
513
enumValues.Add((
JsonNode
)fieldInfo.JsonName);
System\Text\Json\Serialization\Converters\Value\JsonPrimitiveConverter.cs (3)
63
new JsonSchema { Enum = [(
JsonNode
)"NaN", (
JsonNode
)"Infinity", (
JsonNode
)"-Infinity"] },
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (3)
416
JsonNode
? jsonNode,
425
foreach (KeyValuePair<string,
JsonNode
?> property in jsonObject)
463
static string ReadAsStringMetadataValue(
JsonNode
? jsonNode)
System\Text\Json\Serialization\JsonSerializer.Read.HandlePropertyName.cs (1)
126
genericArgs[1].UnderlyingSystemType == typeof(Nodes.
JsonNode
));
System\Text\Json\Serialization\JsonSerializer.Read.Node.cs (17)
15
/// Converts the <see cref="
JsonNode
"/> representing a single JSON value into a <typeparamref name="TValue"/>.
19
/// <param name="node">The <see cref="
JsonNode
"/> to convert.</param>
30
public static TValue? Deserialize<TValue>(this
JsonNode
? node, JsonSerializerOptions? options = null)
37
/// Converts the <see cref="
JsonNode
"/> representing a single JSON value into a <paramref name="returnType"/>.
40
/// <param name="node">The <see cref="
JsonNode
"/> to convert.</param>
52
public static object? Deserialize(this
JsonNode
? node, Type returnType, JsonSerializerOptions? options = null)
64
/// Converts the <see cref="
JsonNode
"/> representing a single JSON value into a <typeparamref name="TValue"/>.
68
/// <param name="node">The <see cref="
JsonNode
"/> to convert.</param>
76
public static TValue? Deserialize<TValue>(this
JsonNode
? node, JsonTypeInfo<TValue> jsonTypeInfo)
88
/// Converts the <see cref="
JsonNode
"/> representing a single JSON value into an instance specified by the <paramref name="jsonTypeInfo"/>.
91
/// <param name="node">The <see cref="
JsonNode
"/> to convert.</param>
96
public static object? Deserialize(this
JsonNode
? node, JsonTypeInfo jsonTypeInfo)
108
/// Converts the <see cref="
JsonNode
"/> representing a single JSON value into a <paramref name="returnType"/>.
111
/// <param name="node">The <see cref="
JsonNode
"/> to convert.</param>
139
public static object? Deserialize(this
JsonNode
? node, Type returnType, JsonSerializerContext context)
154
private static TValue? ReadFromNode<TValue>(
JsonNode
? node, JsonTypeInfo<TValue> jsonTypeInfo)
175
private static object? ReadFromNodeAsObject(
JsonNode
? node, JsonTypeInfo jsonTypeInfo)
System\Text\Json\Serialization\JsonSerializer.Write.Node.cs (19)
15
/// Converts the provided value into a <see cref="
JsonNode
"/>.
18
/// <returns>A <see cref="
JsonNode
"/> representation of the JSON value.</returns>
27
public static
JsonNode
? SerializeToNode<TValue>(TValue value, JsonSerializerOptions? options = null)
34
/// Converts the provided value into a <see cref="
JsonNode
"/>.
36
/// <returns>A <see cref="
JsonNode
"/> representation of the value.</returns>
52
public static
JsonNode
? SerializeToNode(object? value, Type inputType, JsonSerializerOptions? options = null)
60
/// Converts the provided value into a <see cref="
JsonNode
"/>.
63
/// <returns>A <see cref="
JsonNode
"/> representation of the value.</returns>
69
public static
JsonNode
? SerializeToNode<TValue>(TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
81
/// Converts the provided value into a <see cref="
JsonNode
"/>.
83
/// <returns>A <see cref="
JsonNode
"/> representation of the value.</returns>
92
public static
JsonNode
? SerializeToNode(object? value, JsonTypeInfo jsonTypeInfo)
104
/// Converts the provided value into a <see cref="
JsonNode
"/>.
106
/// <returns>A <see cref="
JsonNode
"/> representation of the value.</returns>
121
public static
JsonNode
? SerializeToNode(object? value, Type inputType, JsonSerializerContext context)
133
private static
JsonNode
? WriteNode<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
143
return
JsonNode
.Parse(output.WrittenSpan, options.GetNodeOptions(), options.GetDocumentOptions());
151
private static
JsonNode
? WriteNodeAsObject(object? value, JsonTypeInfo jsonTypeInfo)
161
return
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.
146
public static JsonConverter<
JsonNode
?> JsonNodeConverter => s_jsonNodeConverter ??= new JsonNodeConverter();
147
private static JsonConverter<
JsonNode
?>? s_jsonNodeConverter;