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
678 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)
109
private static
JsonNode
? ConvertAnyValue(AnyValue value)
Aspire.Hosting (2)
Dcp\ApplicationExecutor.cs (2)
2038
var
current = JsonSerializer.SerializeToNode(obj);
2043
var
changed = JsonSerializer.SerializeToNode(copy);
Aspire.Hosting.Azure (13)
AzureBicepResource.cs (1)
156
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)
195
?
JsonNode
.Parse(await File.ReadAllTextAsync(userSecretsPath, cancellationToken).ConfigureAwait(false))!.AsObject()
Provisioning\Provisioners\BicepProvisioner.cs (7)
48
JsonNode
? outputObj = null;
51
outputObj =
JsonNode
.Parse(outputJson);
279
var
az = context.UserSecrets.Prop("Azure");
282
var
resourceConfig = context.UserSecrets
318
var
configOutputs = resourceConfig.Prop("SecretOutputs");
446
var parameters =
JsonNode
.Parse(jsonString)?.AsObject();
503
JsonNode
node => node,
Aspire.Hosting.Azure.Tests (19)
AzureBicepResourceTests.cs (19)
749
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
774
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
813
var
manifest = await ManifestUtils.GetManifest(infrastructure1.Resource);
1546
var
manifest = await ManifestUtils.GetManifest(postgres.Resource);
1997
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2012
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2027
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2156
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2171
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2186
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2314
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2329
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2344
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2473
var
blobManifest = await ManifestUtils.GetManifest(blob.Resource);
2488
var
queueManifest = await ManifestUtils.GetManifest(queue.Resource);
2503
var
tableManifest = await ManifestUtils.GetManifest(table.Resource);
2615
var
aiManifest = await ManifestUtils.GetManifest(ai.Resource);
2619
var
serviceBusManifest = await ManifestUtils.GetManifest(serviceBus.Resource);
2623
var
serviceManifest = await ManifestUtils.GetManifest(serviceA.Resource);
Aspire.Hosting.Containers.Tests (5)
ContainerResourceTests.cs (5)
83
var
manifest = await ManifestUtils.GetManifest(c2.Resource);
113
var
manifest = await ManifestUtils.GetManifest(containerResource);
147
var
manifest = await ManifestUtils.GetManifest(containerResource);
194
var
manifest = await ManifestUtils.GetManifest(containerResource);
243
var
manifest = await ManifestUtils.GetManifest(containerResource, manifestDirectory: appHostPath);
Aspire.Hosting.Elasticsearch.Tests (2)
AddElasticsearchTests.cs (2)
163
var
manifest = await ManifestUtils.GetManifest(elasticsearch.Resource);
202
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)
133
var
manifest = await ManifestUtils.GetManifest(keycloak.Resource);
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
138
var
serverManifest = await ManifestUtils.GetManifest(milvus.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
139
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)
161
var
mySqlManifest = await ManifestUtils.GetManifest(mysql.Resource);
162
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
200
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)
202
var
serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
203
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
241
var
serverManifest = await ManifestUtils.GetManifest(oracleServer.Resource);
Aspire.Hosting.PostgreSQL.Tests (3)
AddPostgresTests.cs (3)
251
var
serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
252
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
295
var
serverManifest = await ManifestUtils.GetManifest(pgServer.Resource);
Aspire.Hosting.Qdrant.Tests (2)
AddQdrantTests.cs (2)
210
var
serverManifest = await ManifestUtils.GetManifest(qdrant.Resource); // using this method does not get any ExecutionContext.IsPublishMode changes
248
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)
205
var
manifest = await ManifestUtils.GetManifest(rabbit.Resource);
251
var
manifest = await ManifestUtils.GetManifest(rabbit.Resource);
Aspire.Hosting.Redis.Tests (3)
AddRedisTests.cs (1)
102
var
manifest = await ManifestUtils.GetManifest(redis.Resource);
RedisFunctionalTests.cs (2)
670
var
jo = JsonObject.Parse(content);
672
var
agreements = jo["agreements"];
Aspire.Hosting.SqlServer.Tests (3)
AddSqlServerTests.cs (3)
132
var
serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
133
var
dbManifest = await ManifestUtils.GetManifest(db.Resource);
173
var
serverManifest = await ManifestUtils.GetManifest(sqlServer.Resource);
Aspire.Hosting.Tests (57)
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();
537
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();
PublishAsDockerfileTests.cs (3)
22
var
manifest = await ManifestUtils.GetManifest(frontend.Resource).DefaultTimeout();
57
var
manifest = await ManifestUtils.GetManifest(frontend.Resource).DefaultTimeout();
95
var
manifest = await ManifestUtils.GetManifest(frontend.Resource).DefaultTimeout();
Schema\SchemaTests.cs (16)
231
var
manifestJson =
JsonNode
.Parse(manifestText);
265
var
manifestJson =
JsonNode
.Parse(manifestText);
285
var
manifestJson =
JsonNode
.Parse(manifestText);
304
var
manifestJson =
JsonNode
.Parse(manifestText);
344
var
manifestJson =
JsonNode
.Parse(manifestText);
367
var
manifestJson =
JsonNode
.Parse(manifestText);
745
var
manifestJson =
JsonNode
.Parse(manifestText);
758
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 (14)
ConfigSchemaEmitter.cs (14)
119
var
backupTypeNode = currentNode["type"];
177
var
existingValue = propertiesNode[pathSegment];
244
var
backupTypeNode = currentNode["type"];
288
var
backupPropertyNode = currentNode[property.ConfigurationKeyName];
319
var
backupTypeNode = currentNode["type"];
320
var
backupContainerNode = currentNode[containerName];
338
private static void RestoreBackup(
JsonNode
? backupNode, string name, JsonObject parentNode)
453
var
propertyNodeType = propertyNode["type"];
722
private sealed class SchemaOrderJsonNodeConverter : JsonConverter<
JsonNode
>
726
public override bool CanConvert(Type typeToConvert) => typeof(
JsonNode
).IsAssignableFrom(typeToConvert) && typeToConvert != typeof(JsonValue);
728
public override void Write(Utf8JsonWriter writer,
JsonNode
? value, JsonSerializerOptions options)
735
IEnumerable<KeyValuePair<string,
JsonNode
>> properties =
749
foreach (
var
item in array)
764
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)
213
Assert.True(secretsJson.TryGetPropertyValue("Foo", out
var
fooField));
431
var
signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray());
434
Assert.True(secretsJson.TryGetPropertyValue("Foo", out
var
fooField));
459
var
signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray());
462
Assert.True(secretsJson.TryGetPropertyValue("Foo", out
var
fooField));
498
var
signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray());
541
var
signingKey1 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray());
545
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 (24)
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)
Services\Schemas\OpenApiSchemaService.cs (1)
217
private
JsonNode
CreateSchema(OpenApiSchemaKey key)
Services\Schemas\OpenApiSchemaStore.cs (3)
18
private readonly ConcurrentDictionary<OpenApiSchemaKey,
JsonNode
> _schemas = new()
61
public
JsonNode
GetOrAdd(OpenApiSchemaKey key, Func<OpenApiSchemaKey,
JsonNode
> valueFactory)
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();
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.WrittenMemory.Span, options.GetNodeOptions(), options.GetDocumentOptions());
151
private static
JsonNode
? WriteNodeAsObject(object? value, JsonTypeInfo jsonTypeInfo)
161
return
JsonNode
.Parse(output.WrittenMemory.Span, 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;