4 types derived from JsonValue
System.Text.Json (4)
System\Text\Json\Nodes\JsonValueOfJsonPrimitive.cs (3)
36
internal sealed class JsonValueOfJsonString :
JsonValue
124
internal sealed class JsonValueOfJsonBool :
JsonValue
170
internal sealed class JsonValueOfJsonNumber :
JsonValue
System\Text\Json\Nodes\JsonValueOfT.cs (1)
11
internal abstract class JsonValue<TValue> :
JsonValue
539 references to JsonValue
aspire (29)
Agents\AspireSkills\GitHubArtifactAttestationVerifier.cs (1)
175
if (bundleNode is
JsonValue
bundleValue && bundleValue.TryGetValue<string>(out var bundleString))
Agents\Hooks\TelemetryHookConfigurator.cs (2)
351
&& commandNode is
JsonValue
commandValue
362
if (arg is
JsonValue
argValue
Backchannel\ResourceSnapshotMapper.cs (1)
216
if (node is
JsonValue
jsonValue && jsonValue.TryGetValue<string>(out var stringValue))
Mcp\Tools\ExecuteResourceCommandTool.cs (4)
180
JsonValueKind.String =>
JsonValue
.Create(property.Value.GetString()),
181
JsonValueKind.Number =>
JsonValue
.Create(property.Value.GetRawText()),
182
JsonValueKind.True =>
JsonValue
.Create("true"),
183
JsonValueKind.False =>
JsonValue
.Create("false"),
Mcp\Tools\McpToolHelpers.cs (1)
127
if (value is
JsonValue
jsonValue)
Migrations\TypeScriptAppHostMigration.cs (5)
202
appHost["path"] is not
JsonValue
pathValue ||
256
if (entry is
JsonValue
value && value.GetValueKind() is JsonValueKind.String)
260
rewritten.Add((JsonNode?)
JsonValue
.Create(LegacyTypeScriptAppHost.RewriteTsConfigIncludeEntry(value.GetValue<string>())));
296
if (script.Value is
JsonValue
value &&
303
scripts[script.Key] = (JsonNode?)
JsonValue
.Create(rewritten);
Npm\SigstoreNpmProvenanceChecker.cs (1)
211
if (predicateTypeNode is not
JsonValue
predicateTypeValue)
Projects\FallbackProjectParser.cs (6)
131
packageObj["Identity"] =
JsonValue
.Create(pkg.Identity);
132
packageObj["Version"] =
JsonValue
.Create(pkg.Version);
142
projectObj["Identity"] =
JsonValue
.Create(proj.Identity);
143
projectObj["FullPath"] =
JsonValue
.Create(proj.FullPath);
152
propertiesObject["AspireHostingSDKVersion"] =
JsonValue
.Create(aspireHostingSdkVersion);
156
rootObject["Fallback"] =
JsonValue
.Create(true);
Projects\TypeScriptAppHostToolchainResolver.cs (1)
311
if (packageJson?["packageManager"] is not
JsonValue
packageManagerValue ||
Scaffolding\PackageJsonMerger.cs (4)
155
if (value is not
JsonValue
scriptValue || !scriptValue.TryGetValue<string>(out var command))
229
if (versionNode is not
JsonValue
desiredValue || !desiredValue.TryGetValue<string>(out var desiredVersion))
249
if (existingVersionNode is
JsonValue
existingValue
272
if (existingVersionNode is
JsonValue
existingValue
Scaffolding\ScaffoldingService.cs (1)
399
if (scripts[scriptName] is
JsonValue
existingScriptValue &&
src\Shared\Json\AtsJsonCodeWriter.cs (1)
33
return
JsonValue
.Create(value)!.ToJsonString(s_relaxedJsonOptions);
Telemetry\InternalMicrosoftDetector.cs (1)
1309
value is
JsonValue
jsonValue &&
Aspire.Cli.Tests (23)
Agents\TelemetryHookConfiguratorTests.cs (2)
249
=> node is
JsonValue
v && v.ToString().Contains("track-telemetry", StringComparison.OrdinalIgnoreCase);
255
&& ho["command"] is
JsonValue
v
Backchannel\ResourceSnapshotMapperTests.cs (4)
30
var
pid = Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["executable.pid"]);
344
["custom.list"] = new JsonArray((JsonNode?)
JsonValue
.Create("one"), (JsonNode?)
JsonValue
.Create("two"))
Commands\ResourceCommandTests.cs (2)
2295
var
actualElement = Assert.IsAssignableFrom<
JsonValue
>(actualValue);
Commands\SdkDumpCommandTests.cs (1)
371
Value =
JsonValue
.Create("你好"),
Mcp\ExcludeFromMcpTests.cs (8)
45
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create(true)
60
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create(false)
75
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create("true")
120
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create(true)
153
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create(true)
185
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create(true)
257
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create(true)
451
[KnownProperties.Resource.ExcludeFromMcp] =
JsonValue
.Create(true)
Projects\ProjectUpdaterTests.cs (6)
4074
properties.Add("AspireHostingSDKVersion",
JsonValue
.Create<string>(sdkVersion));
4110
{ "Identity",
JsonValue
.Create<string>(packageId) },
4111
{ "Version",
JsonValue
.Create<string>(packageVersion) }
4126
{ "Identity",
JsonValue
.Create<string>(packageId) }
4142
{ "FullPath",
JsonValue
.Create<string>(fullPath) }
4157
properties.Add(propertyName,
JsonValue
.Create<string>(propertyValue));
Aspire.Dashboard (10)
Model\GenAI\GenAISchemaHelpers.cs (2)
94
if (item is
JsonValue
&& item.GetValueKind() == System.Text.Json.JsonValueKind.String)
110
if (typeNode is
JsonValue
&& typeNode.GetValueKind() == System.Text.Json.JsonValueKind.String)
Model\TelemetryExportService.cs (3)
790
return
JsonValue
.Create(stringValue);
795
return
JsonValue
.Create(value.NumberValue);
800
return
JsonValue
.Create(value.BoolValue);
Otlp\Model\OtlpHelpers.cs (5)
174
AnyValue.ValueOneofCase.StringValue =>
JsonValue
.Create(value.StringValue),
175
AnyValue.ValueOneofCase.IntValue =>
JsonValue
.Create(value.IntValue),
176
AnyValue.ValueOneofCase.DoubleValue =>
JsonValue
.Create(value.DoubleValue),
177
AnyValue.ValueOneofCase.BoolValue =>
JsonValue
.Create(value.BoolValue),
178
AnyValue.ValueOneofCase.BytesValue =>
JsonValue
.Create(value.BytesValue.ToHexString()),
Aspire.Dashboard.Tests (2)
Model\GenAIItemPartViewModelTests.cs (2)
20
Response =
JsonValue
.Create("**Markdown**")
39
Response =
JsonValue
.Create(expectedText)
Aspire.Hosting (26)
Backchannel\AuxiliaryBackchannelRpcTarget.cs (18)
1392
string stringValue =>
JsonValue
.Create(stringValue),
1393
bool boolValue =>
JsonValue
.Create(boolValue),
1394
byte byteValue =>
JsonValue
.Create(byteValue),
1395
sbyte sbyteValue =>
JsonValue
.Create(sbyteValue),
1396
short shortValue =>
JsonValue
.Create(shortValue),
1397
ushort ushortValue =>
JsonValue
.Create(ushortValue),
1398
int intValue =>
JsonValue
.Create(intValue),
1399
uint uintValue =>
JsonValue
.Create(uintValue),
1400
long longValue =>
JsonValue
.Create(longValue),
1401
ulong ulongValue =>
JsonValue
.Create(ulongValue),
1402
float floatValue =>
JsonValue
.Create(floatValue),
1403
double doubleValue =>
JsonValue
.Create(doubleValue),
1404
decimal decimalValue =>
JsonValue
.Create(decimalValue),
1407
_ =>
JsonValue
.Create(value.ToString())
1426
return stringValue is null ? null :
JsonValue
.Create(stringValue);
1434
JsonValue
jsonValue when jsonValue.TryGetValue<string>(out var stringValue) => stringValue,
1435
JsonValue
jsonValue when jsonValue.TryGetValue<bool>(out var boolValue) => boolValue.ToString(CultureInfo.InvariantCulture),
1436
JsonValue
jsonValue when jsonValue.TryGetValue<IFormattable>(out var formattableValue) => formattableValue.ToString(null, CultureInfo.InvariantCulture),
Dcp\JsonPatch.cs (2)
32
operation["op"] is not
JsonValue
operationValue ||
33
operation["path"] is not
JsonValue
pathValue ||
Pipelines\DeploymentStateSection.cs (1)
58
Data[RootValueKey] =
JsonValue
.Create(value);
Pipelines\Internal\DeploymentStateManagerBase.cs (1)
197
else if (sectionData is
JsonValue
jsonValue && jsonValue.GetValueKind() == JsonValueKind.String)
Pipelines\Internal\FileDeploymentStateManager.cs (4)
385
JsonValue
sectionValue when sectionValue.GetValueKind() == JsonValueKind.String =>
758
JsonValue
claimedSectionsValue => ParseClaimedSectionNames(claimedSectionsValue),
764
JsonValue
stateValue => JsonNode.Parse(stateValue.GetValue<string>())?.AsObject()
772
private static string[] ParseClaimedSectionNames(
JsonValue
claimedSectionsValue)
Aspire.Hosting.Azure (2)
AzureProvisioningController.cs (1)
2454
deletedResourceIds.Add(
JsonValue
.Create(resourceId));
Provisioning\BicepUtilities.cs (1)
60
IEnumerable<string> s => new JsonArray(s.Select(s =>
JsonValue
.Create(s)).ToArray()),
Aspire.Hosting.Azure.Sandboxes (1)
AzureSandboxContainerDeployment.cs (1)
1880
.Select(static ownerId =>
JsonValue
.Create(ownerId))
Aspire.Hosting.Azure.Tests (2)
AzureEventHubsExtensionsTests.cs (1)
404
document["Custom"] =
JsonValue
.Create(42);
AzureServiceBusExtensionsTests.cs (1)
516
document["Custom"] =
JsonValue
.Create(42);
Aspire.Hosting.CodeGeneration.Go (1)
src\Shared\Json\AtsJsonCodeWriter.cs (1)
33
return
JsonValue
.Create(value)!.ToJsonString(s_relaxedJsonOptions);
Aspire.Hosting.CodeGeneration.Java (1)
src\Shared\Json\AtsJsonCodeWriter.cs (1)
33
return
JsonValue
.Create(value)!.ToJsonString(s_relaxedJsonOptions);
Aspire.Hosting.CodeGeneration.Python (3)
AtsPythonCodeGenerator.cs (2)
990
JsonValue
jsonValue when jsonValue.TryGetValue<bool>(out var boolValue) => boolValue ? "True" : "False",
991
JsonValue
jsonValue => jsonValue.ToRelaxedJsonString(),
src\Shared\Json\AtsJsonCodeWriter.cs (1)
33
return
JsonValue
.Create(value)!.ToJsonString(s_relaxedJsonOptions);
Aspire.Hosting.CodeGeneration.Rust (1)
src\Shared\Json\AtsJsonCodeWriter.cs (1)
33
return
JsonValue
.Create(value)!.ToJsonString(s_relaxedJsonOptions);
Aspire.Hosting.CodeGeneration.TypeScript (3)
src\Shared\Json\AtsJsonCodeWriter.cs (1)
33
return
JsonValue
.Create(value)!.ToJsonString(s_relaxedJsonOptions);
TypeScriptApiExportWriter.cs (1)
191
array.Add((JsonNode)
JsonValue
.Create(value));
TypeScriptLanguageSupport.cs (1)
220
return node is
JsonValue
value && value.TryGetValue<string>(out var stringValue) ? stringValue : null;
Aspire.Hosting.RemoteHost (32)
Ats\AtsMarshaller.cs (20)
159
AtsTypeCategory.Enum =>
JsonValue
.Create(value.ToString()),
197
AtsTypeCategory.Enum =>
JsonValue
.Create(value.ToString()),
214
return
JsonValue
.Create(((TimeSpan)value).TotalMilliseconds);
220
return
JsonValue
.Create(((DateOnly)value).ToString("O", System.Globalization.CultureInfo.InvariantCulture));
226
return
JsonValue
.Create(((TimeOnly)value).ToString("O", System.Globalization.CultureInfo.InvariantCulture));
229
return
JsonValue
.Create(value);
473
AtsTypeCategory.Enum =>
JsonValue
.Create(value.ToString()),
501
return
JsonValue
.Create(tokenId);
579
return node is
JsonValue
value ? ConvertPrimitive(value, targetType) : node;
586
if (node is
JsonValue
callbackValue && callbackValue.TryGetValue<string>(out var callbackId))
602
if (node is
JsonValue
tokenValue && tokenValue.TryGetValue<string>(out var tokenId) && !string.IsNullOrEmpty(tokenId))
615
if (node is
JsonValue
value)
741
JsonValue
v when v.TryGetValue<string>(out _) => "string",
742
JsonValue
v when v.TryGetValue<bool>(out _) => "bool",
743
JsonValue
v when v.TryGetValue<long>(out _) => "number",
744
JsonValue
v when v.TryGetValue<double>(out _) => "number",
745
JsonValue
=> "value",
770
private static decimal ReadDecimalValue(
JsonValue
value, Type targetType)
808
private static decimal ReadIntegralNumericValue(
JsonValue
value, Type targetType, decimal minValue, decimal maxValue)
856
public static object? ConvertPrimitive(
JsonValue
value, Type targetType)
Ats\CapabilityDispatcher.cs (9)
942
node is
JsonValue
value &&
951
JsonValue
v when v.TryGetValue<string>(out _) => "string",
952
JsonValue
v when v.TryGetValue<bool>(out _) => "bool",
953
JsonValue
v when v.TryGetValue<long>(out _) => "number",
954
JsonValue
v when v.TryGetValue<double>(out _) => "number",
955
JsonValue
=> "value",
1030
if (!args.TryGetPropertyValue(name, out var node) || node is not
JsonValue
value)
1044
if (args.TryGetPropertyValue(name, out var node) && node is
JsonValue
value)
1056
if (args.TryGetPropertyValue(name, out var node) && node is
JsonValue
value)
Ats\ReferenceExpressionRef.cs (3)
89
matchValueNode is
JsonValue
matchValueJsonValue &&
106
formatNode is not
JsonValue
formatValue ||
230
else if (providerNode is
JsonValue
jsonValue && jsonValue.TryGetValue<string>(out var stringValue))
Aspire.Hosting.RemoteHost.Tests (87)
AtsContextFilterTests.cs (2)
582
Value =
JsonValue
.Create("selected")
608
Value =
JsonValue
.Create("unrelated")
AtsMarshallerTests.cs (72)
52
public static TheoryData<Type,
JsonValue
, object> WholeDoubleAdditionalIntegralTypes => new()
54
{ typeof(byte),
JsonValue
.Create(42.0)!, (byte)42 },
55
{ typeof(short),
JsonValue
.Create(42.0)!, (short)42 },
56
{ typeof(uint),
JsonValue
.Create(42.0)!, 42u },
57
{ typeof(ulong),
JsonValue
.Create(42.0)!, 42ul },
58
{ typeof(ushort),
JsonValue
.Create(42.0)!, (ushort)42 },
59
{ typeof(sbyte),
JsonValue
.Create(42.0)!, (sbyte)42 },
62
public static TheoryData<Type,
JsonValue
> FractionalAdditionalIntegralTypes => new()
64
{ typeof(byte),
JsonValue
.Create(42.5)! },
65
{ typeof(short),
JsonValue
.Create(42.5)! },
66
{ typeof(uint),
JsonValue
.Create(42.5)! },
67
{ typeof(ulong),
JsonValue
.Create(42.5)! },
68
{ typeof(ushort),
JsonValue
.Create(42.5)! },
69
{ typeof(sbyte),
JsonValue
.Create(42.5)! },
72
public static TheoryData<Type,
JsonValue
> OverflowAdditionalIntegralTypes => new()
74
{ typeof(byte),
JsonValue
.Create(256.0)! },
75
{ typeof(short),
JsonValue
.Create(32768.0)! },
76
{ typeof(uint),
JsonValue
.Create(-1.0)! },
77
{ typeof(ulong),
JsonValue
.Create(-1.0)! },
78
{ typeof(ushort),
JsonValue
.Create(65536.0)! },
79
{ typeof(sbyte),
JsonValue
.Create(128.0)! },
210
var
tokenValue = Assert.IsAssignableFrom<
JsonValue
>(result);
231
var
tokenValue = Assert.IsAssignableFrom<
JsonValue
>(result);
241
var
value =
JsonValue
.Create("test");
251
var
value =
JsonValue
.Create(42);
261
var
value =
JsonValue
.Create(11433.0);
271
var
value =
JsonValue
.Create(11433.5);
278
public void ConvertPrimitive_ConvertsWholeDoubleForAdditionalIntegralTypes(Type targetType,
JsonValue
value, object expected)
287
public void ConvertPrimitive_RejectsFractionalDoubleForAdditionalIntegralTypes(Type targetType,
JsonValue
value)
294
public void ConvertPrimitive_RejectsOutOfRangeValuesForAdditionalIntegralTypes(Type targetType,
JsonValue
value)
302
var
value =
JsonValue
.Create(true);
312
var
value =
JsonValue
.Create(1500.0);
322
var
value =
JsonValue
.Create(42);
467
var
value =
JsonValue
.Create("2024-06-15");
490
var
value =
JsonValue
.Create("14:30:45");
587
var
value =
JsonValue
.Create(9223372036854775807L);
597
var
value =
JsonValue
.Create(5000000000d);
607
var
value =
JsonValue
.Create(9007199254740992d);
615
var
value =
JsonValue
.Create(3.14159);
625
var
value =
JsonValue
.Create(1e100);
635
var
value =
JsonValue
.Create(3.14);
645
var
value =
JsonValue
.Create(123.456m);
655
var
value =
JsonValue
.Create(1e100);
663
var
value =
JsonValue
.Create("01:30:00");
850
var
json =
JsonValue
.Create("ValueB");
861
var
json =
JsonValue
.Create("valueb"); // lowercase
872
var
json =
JsonValue
.Create(1); // ValueB is index 1
883
var
json =
JsonValue
.Create("ValueA");
CallbackProxyTests.cs (3)
74
var invoker = new TestCallbackInvoker { ResultToReturn =
JsonValue
.Create(42) };
177
var invoker = new TestCallbackInvoker { ResultToReturn =
JsonValue
.Create("result-value") };
328
["p0"] =
JsonValue
.Create("some-string"),
CapabilityDispatcherTests.cs (4)
18
CapabilityHandler handler = (args, handles) => Task.FromResult<JsonNode?>(
JsonValue
.Create("result"));
54
return Task.FromResult<JsonNode?>(
JsonValue
.Create("success"));
82
dispatcher.Register("test/capability@1", (_, _) => Task.FromResult<JsonNode?>(
JsonValue
.Create(42)));
726
var invoker = new TestCallbackInvoker { ResultToReturn =
JsonValue
.Create(42) };
HandleRegistryTests.cs (4)
267
var
json =
JsonValue
.Create("not an object");
326
var
json =
JsonValue
.Create("string");
ReferenceExpressionRefTests.cs (2)
175
JsonValue
.Create("6379")
198
JsonValue
.Create("6379")
Aspire.Hosting.Tests (14)
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (10)
325
var
normalJsonValue = Assert.IsAssignableFrom<
JsonValue
>(normalValue);
1278
Assert.Equal("42", Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["number"]).GetValue<string>());
1279
Assert.Equal(bool.TrueString, Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["flag"]).GetValue<string>());
1280
Assert.Equal("one,two", Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["list"]).GetValue<string>());
1325
Assert.Equal(42, Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["number"]).GetValue<int>());
1326
Assert.True(Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["flag"]).GetValue<bool>());
1370
Assert.Equal("true", Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["terminal.enabled"]).GetValue<string>());
1371
Assert.Equal("0", Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["terminal.replicaIndex"]).GetValue<string>());
1372
Assert.Equal("1", Assert.IsAssignableFrom<
JsonValue
>(snapshot.Properties["terminal.replicaCount"]).GetValue<string>());
Dcp\JsonPatchTests.cs (4)
30
var
current =
JsonValue
.Create("before");
31
var
changed =
JsonValue
.Create("after");
ConfigurationSchemaGenerator (1)
ConfigSchemaEmitter.cs (1)
733
public override bool CanConvert(Type typeToConvert) => typeof(JsonNode).IsAssignableFrom(typeToConvert) && typeToConvert != typeof(
JsonValue
);
dotnet (1)
Commands\New\MSBuildEvaluation\ProjectCapabilityConstraint.cs (1)
86
if (token is
JsonValue
v && v.GetValueKind() == JsonValueKind.String)
dotnet-user-jwts (1)
Helpers\JwtAuthenticationSchemeSettings.cs (1)
24
[nameof(TokenValidationParameters.ValidAudiences)] = new JsonArray(Audiences.Select(aud =>
JsonValue
.Create(aud)).ToArray()),
Infrastructure.Tests (1)
Pipelines\NixCliPackageTests.cs (1)
265
return Assert.IsAssignableFrom<
JsonValue
>(value).GetValue<string>();
Microsoft.AspNetCore.JsonPatch.SystemTextJson (2)
Internal\JsonObjectAdapter.cs (2)
141
private static
JsonValue
GetJsonNull() =>
JsonValue
.Create<object>(null);
Microsoft.AspNetCore.OpenApi (5)
Extensions\JsonNodeSchemaExtensions.cs (2)
617
return jsonNode is
JsonValue
jsonValue && jsonValue.TryGetValue<string>(out var identifier)
626
if (node is
JsonValue
jsonValue && jsonValue.TryGetValue<string>(out var identifier))
Services\OpenApiDocumentService.cs (2)
550
eventSchema.Enum = [.. mapping.Keys.Select(static eventName =>
JsonValue
.Create(eventName)!)];
559
.Select(static schemaReference =>
JsonValue
.Create(schemaReference.Reference.Id)!)
Services\Schemas\OpenApiSchemaService.cs (1)
592
refNode is
JsonValue
refValue &&
Microsoft.Extensions.AI (1)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
226
_ =>
JsonValue
.Create(element)
Microsoft.Extensions.AI.Abstractions (10)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
496
if (type == typeof(global::System.Text.Json.Nodes.
JsonValue
))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.JsonValue.g.cs (8)
15
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
>? _JsonValue;
21
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> JsonValue
24
get => _JsonValue ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.
JsonValue
));
27
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> Create_JsonValue(global::System.Text.Json.JsonSerializerOptions options)
29
if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.
JsonValue
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> jsonTypeInfo))
31
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.
JsonValue
>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonValueConverter);
Utilities\AIJsonUtilities.Defaults.cs (1)
74
[JsonSerializable(typeof(
JsonValue
))]
Microsoft.Extensions.AI.Abstractions.Tests (12)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestTypesContext.GetJsonTypeInfo.g.cs (1)
352
if (type == typeof(global::System.Text.Json.Nodes.
JsonValue
))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestTypesContext.JsonValue.g.cs (8)
15
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
>? _JsonValue;
21
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> JsonValue
24
get => _JsonValue ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.
JsonValue
));
27
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> Create_JsonValue(global::System.Text.Json.JsonSerializerOptions options)
29
if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.
JsonValue
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> jsonTypeInfo))
31
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.
JsonValue
>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonValueConverter);
parent\parent\Shared\JsonSchemaExporter\TestTypes.cs (3)
104
yield return new TestData<
JsonValue
>((
JsonValue
)42, "true");
1248
[JsonSerializable(typeof(
JsonValue
))]
Microsoft.ML.AutoML (9)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (2)
17
var jValue =
JsonValue
.Parse(ref reader);
28
jsonObject["estimators"] =
JsonValue
.Create(value.Estimators);
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (3)
18
var jsonObject =
JsonValue
.Parse(ref reader);
30
jObject["estimatorType"] =
JsonValue
.Create(value.EstimatorType);
31
jObject["parameter"] =
JsonValue
.Create(value.Parameter);
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (2)
30
jNode["parameter"] =
JsonValue
.Create(parameter);
31
jNode["estimators"] =
JsonValue
.Create(estimators);
SweepableEstimator\Converter\SweepablePipelineConverter.cs (2)
17
var jValue =
JsonValue
.Parse(ref reader);
30
jsonObject["estimators"] =
JsonValue
.Create(value.Estimators);
Microsoft.NET.Build.Containers (2)
ImageConfig.cs (2)
168
static JsonArray ToJsonArray(IEnumerable<string> items) => new(items.Where(s => !string.IsNullOrEmpty(s)).Select(s =>
JsonValue
.Create(s)).ToArray<JsonNode?>());
270
if (property.Key is { } propertyName && property.Value is
JsonValue
propertyValue)
Microsoft.NET.Build.Tasks (3)
GenerateRuntimeConfigurationFiles.cs (3)
338
return
JsonValue
.Create(boolValue);
343
return
JsonValue
.Create(intValue);
346
return
JsonValue
.Create(valueString);
Microsoft.TemplateEngine.Cli (3)
Alias\AliasRegistry.cs (1)
156
arr.Add((JsonNode)
JsonValue
.Create(item)!);
JExtensions.cs (2)
28
if (token is
JsonValue
val && val.GetValueKind() == JsonValueKind.String)
253
if (token is
JsonValue
jv && jv.TryGetValue(out int intVal))
Microsoft.TemplateEngine.Edge (3)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (3)
36
if (token is
JsonValue
val && val.GetValueKind() == JsonValueKind.String)
55
if (element is
JsonValue
strVal && strVal.GetValueKind() == JsonValueKind.String)
130
if (token is
JsonValue
jv && jv.TryGetValue(out int intVal))
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (4)
Macros\BaseMacroConfig.cs (1)
123
if (jToken is not
JsonValue
val)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (3)
36
if (token is
JsonValue
val && val.GetValueKind() == JsonValueKind.String)
55
if (element is
JsonValue
strVal && strVal.GetValueKind() == JsonValueKind.String)
130
if (token is
JsonValue
jv && jv.TryGetValue(out int intVal))
Microsoft.TemplateEngine.Utils (3)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (3)
36
if (token is
JsonValue
val && val.GetValueKind() == JsonValueKind.String)
55
if (element is
JsonValue
strVal && strVal.GetValueKind() == JsonValueKind.String)
130
if (token is
JsonValue
jv && jv.TryGetValue(out int intVal))
Microsoft.TemplateSearch.Common (5)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (3)
36
if (token is
JsonValue
val && val.GetValueKind() == JsonValueKind.String)
55
if (element is
JsonValue
strVal && strVal.GetValueKind() == JsonValueKind.String)
130
if (token is
JsonValue
jv && jv.TryGetValue(out int intVal))
TemplateDiscoveryMetadata\BlobStorageTemplateInfo.cs (1)
241
if (item.Value is
JsonValue
jv && jv.GetValueKind() == JsonValueKind.String)
TemplateDiscoveryMetadata\LegacySearchCacheReader.cs (1)
167
if (versionNode is
JsonValue
versionVal && versionVal.GetValueKind() == JsonValueKind.String
Shared.Tests (12)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestTypesContext.GetJsonTypeInfo.g.cs (1)
364
if (type == typeof(global::System.Text.Json.Nodes.
JsonValue
))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestTypesContext.JsonValue.g.cs (8)
15
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
>? _JsonValue;
21
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> JsonValue
24
get => _JsonValue ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.
JsonValue
));
27
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> Create_JsonValue(global::System.Text.Json.JsonSerializerOptions options)
29
if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.
JsonValue
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.
JsonValue
> jsonTypeInfo))
31
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.
JsonValue
>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonValueConverter);
JsonSchemaExporter\TestTypes.cs (3)
104
yield return new TestData<
JsonValue
>((
JsonValue
)42, "true");
1248
[JsonSerializable(typeof(
JsonValue
))]
System.Text.Json (224)
System\Text\Json\Nodes\JsonArray.cs (5)
104
case
JsonValue
value:
139
/// <typeparam name="T">The type of the value to obtain from the <see cref="
JsonValue
"/>.</typeparam>
216
[RequiresUnreferencedCode(
JsonValue
.CreateUnreferencedCodeMessage)]
217
[RequiresDynamicCode(
JsonValue
.CreateDynamicCodeMessage)]
388
if (Value is
JsonValue
)
System\Text\Json\Nodes\JsonNode.cs (18)
97
/// Casts to the derived <see cref="
JsonValue
"/> type.
100
/// A <see cref="
JsonValue
"/>.
103
/// The node is not a <see cref="
JsonValue
"/>.
105
public
JsonValue
AsValue()
107
JsonValue
? jValue = this as
JsonValue
;
111
ThrowHelper.ThrowInvalidOperationException_NodeWrongType(nameof(
JsonValue
));
179
/// Gets the value for the current <see cref="
JsonValue
"/>.
181
/// <typeparam name="T">The type of the value to obtain from the <see cref="
JsonValue
"/>.</typeparam>
182
/// <returns>A value converted from the <see cref="
JsonValue
"/> instance.</returns>
188
/// The underlying value of a <see cref="
JsonValue
"/> after deserialization is an instance of <see cref="JsonElement"/>,
189
/// otherwise it's the value specified when the <see cref="
JsonValue
"/> was created.
191
/// <seealso cref="System.Text.Json.Nodes.
JsonValue
.TryGetValue"></seealso>
196
/// The current <see cref="JsonNode"/> is not a <see cref="
JsonValue
"/> or
200
throw new InvalidOperationException(SR.Format(SR.NodeWrongType, nameof(
JsonValue
)));
328
[RequiresUnreferencedCode(
JsonValue
.CreateUnreferencedCodeMessage)]
329
[RequiresDynamicCode(
JsonValue
.CreateDynamicCodeMessage)]
392
return
JsonValue
.CreateFromTypeInfo(value, jsonTypeInfo, options);
System\Text\Json\Nodes\JsonNode.Operators.cs (33)
15
public static implicit operator JsonNode(bool value) =>
JsonValue
.Create(value);
22
public static implicit operator JsonNode?(bool? value) =>
JsonValue
.Create(value);
29
public static implicit operator JsonNode(byte value) =>
JsonValue
.Create(value);
36
public static implicit operator JsonNode?(byte? value) =>
JsonValue
.Create(value);
43
public static implicit operator JsonNode(char value) =>
JsonValue
.Create(value);
50
public static implicit operator JsonNode?(char? value) =>
JsonValue
.Create(value);
57
public static implicit operator JsonNode(DateTime value) =>
JsonValue
.Create(value);
64
public static implicit operator JsonNode?(DateTime? value) =>
JsonValue
.Create(value);
71
public static implicit operator JsonNode(DateTimeOffset value) =>
JsonValue
.Create(value);
78
public static implicit operator JsonNode?(DateTimeOffset? value) =>
JsonValue
.Create(value);
85
public static implicit operator JsonNode(decimal value) =>
JsonValue
.Create(value);
92
public static implicit operator JsonNode?(decimal? value) =>
JsonValue
.Create(value);
99
public static implicit operator JsonNode(double value) =>
JsonValue
.Create(value);
106
public static implicit operator JsonNode?(double? value) =>
JsonValue
.Create(value);
113
public static implicit operator JsonNode(Guid value) =>
JsonValue
.Create(value);
120
public static implicit operator JsonNode?(Guid? value) =>
JsonValue
.Create(value);
127
public static implicit operator JsonNode(short value) =>
JsonValue
.Create(value);
134
public static implicit operator JsonNode?(short? value) =>
JsonValue
.Create(value);
141
public static implicit operator JsonNode(int value) =>
JsonValue
.Create(value);
148
public static implicit operator JsonNode?(int? value) =>
JsonValue
.Create(value);
155
public static implicit operator JsonNode(long value) =>
JsonValue
.Create(value);
162
public static implicit operator JsonNode?(long? value) =>
JsonValue
.Create(value);
170
public static implicit operator JsonNode(sbyte value) =>
JsonValue
.Create(value);
178
public static implicit operator JsonNode?(sbyte? value) =>
JsonValue
.Create(value);
185
public static implicit operator JsonNode(float value) =>
JsonValue
.Create(value);
192
public static implicit operator JsonNode?(float? value) =>
JsonValue
.Create(value);
200
public static implicit operator JsonNode?(string? value) =>
JsonValue
.Create(value);
208
public static implicit operator JsonNode(ushort value) =>
JsonValue
.Create(value);
216
public static implicit operator JsonNode?(ushort? value) =>
JsonValue
.Create(value);
224
public static implicit operator JsonNode(uint value) =>
JsonValue
.Create(value);
232
public static implicit operator JsonNode?(uint? value) =>
JsonValue
.Create(value);
240
public static implicit operator JsonNode(ulong value) =>
JsonValue
.Create(value);
248
public static implicit operator JsonNode?(ulong? value) =>
JsonValue
.Create(value);
System\Text\Json\Nodes\JsonNode.To.cs (1)
43
if (this is
JsonValue
)
System\Text\Json\Nodes\JsonObject.cs (2)
211
case
JsonValue
value:
367
if (Value is
JsonValue
)
System\Text\Json\Nodes\JsonValue.CreateOverloads.cs (142)
12
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
14
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
16
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
17
public static
JsonValue
Create(bool value, JsonNodeOptions? options = null) => new JsonValuePrimitive<bool>(value, JsonMetadataServices.BooleanConverter, options);
20
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
22
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
24
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
25
public static
JsonValue
? Create(bool? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<bool>(value.Value, JsonMetadataServices.BooleanConverter, options) : null;
28
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
30
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
32
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
33
public static
JsonValue
Create(byte value, JsonNodeOptions? options = null) => new JsonValuePrimitive<byte>(value, JsonMetadataServices.ByteConverter, options);
36
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
38
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
40
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
41
public static
JsonValue
? Create(byte? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<byte>(value.Value, JsonMetadataServices.ByteConverter, options) : null;
44
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
46
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
48
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
49
public static
JsonValue
Create(char value, JsonNodeOptions? options = null) => new JsonValuePrimitive<char>(value, JsonMetadataServices.CharConverter, options);
52
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
54
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
56
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
57
public static
JsonValue
? Create(char? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<char>(value.Value, JsonMetadataServices.CharConverter, options) : null;
60
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
62
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
64
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
65
public static
JsonValue
Create(DateTime value, JsonNodeOptions? options = null) => new JsonValuePrimitive<DateTime>(value, JsonMetadataServices.DateTimeConverter, options);
68
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
70
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
72
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
73
public static
JsonValue
? Create(DateTime? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<DateTime>(value.Value, JsonMetadataServices.DateTimeConverter, options) : null;
76
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
78
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
80
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
81
public static
JsonValue
Create(DateTimeOffset value, JsonNodeOptions? options = null) => new JsonValuePrimitive<DateTimeOffset>(value, JsonMetadataServices.DateTimeOffsetConverter, options);
84
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
86
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
88
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
89
public static
JsonValue
? Create(DateTimeOffset? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<DateTimeOffset>(value.Value, JsonMetadataServices.DateTimeOffsetConverter, options) : null;
92
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
94
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
96
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
97
public static
JsonValue
Create(decimal value, JsonNodeOptions? options = null) => new JsonValuePrimitive<decimal>(value, JsonMetadataServices.DecimalConverter, options);
100
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
102
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
104
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
105
public static
JsonValue
? Create(decimal? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<decimal>(value.Value, JsonMetadataServices.DecimalConverter, options) : null;
108
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
110
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
112
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
113
public static
JsonValue
Create(double value, JsonNodeOptions? options = null) => new JsonValuePrimitive<double>(value, JsonMetadataServices.DoubleConverter, options);
116
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
118
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
120
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
121
public static
JsonValue
? Create(double? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<double>(value.Value, JsonMetadataServices.DoubleConverter, options) : null;
124
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
126
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
128
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
129
public static
JsonValue
Create(Guid value, JsonNodeOptions? options = null) => new JsonValuePrimitive<Guid>(value, JsonMetadataServices.GuidConverter, options);
132
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
134
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
136
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
137
public static
JsonValue
? Create(Guid? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<Guid>(value.Value, JsonMetadataServices.GuidConverter, options) : null;
140
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
142
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
144
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
145
public static
JsonValue
Create(short value, JsonNodeOptions? options = null) => new JsonValuePrimitive<short>(value, JsonMetadataServices.Int16Converter, options);
148
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
150
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
152
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
153
public static
JsonValue
? Create(short? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<short>(value.Value, JsonMetadataServices.Int16Converter, options) : null;
156
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
158
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
160
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
161
public static
JsonValue
Create(int value, JsonNodeOptions? options = null) => new JsonValuePrimitive<int>(value, JsonMetadataServices.Int32Converter, options);
164
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
166
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
168
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
169
public static
JsonValue
? Create(int? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<int>(value.Value, JsonMetadataServices.Int32Converter, options) : null;
172
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
174
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
176
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
177
public static
JsonValue
Create(long value, JsonNodeOptions? options = null) => new JsonValuePrimitive<long>(value, JsonMetadataServices.Int64Converter, options);
180
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
182
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
184
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
185
public static
JsonValue
? Create(long? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<long>(value.Value, JsonMetadataServices.Int64Converter, options) : null;
188
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
190
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
192
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
194
public static
JsonValue
Create(sbyte value, JsonNodeOptions? options = null) => new JsonValuePrimitive<sbyte>(value, JsonMetadataServices.SByteConverter, options);
197
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
199
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
201
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
203
public static
JsonValue
? Create(sbyte? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<sbyte>(value.Value, JsonMetadataServices.SByteConverter, options) : null;
206
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
208
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
210
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
211
public static
JsonValue
Create(float value, JsonNodeOptions? options = null) => new JsonValuePrimitive<float>(value, JsonMetadataServices.SingleConverter, options);
214
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
216
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
218
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
219
public static
JsonValue
? Create(float? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<float>(value.Value, JsonMetadataServices.SingleConverter, options) : null;
222
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
224
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
226
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
228
public static
JsonValue
? Create(string? value, JsonNodeOptions? options = null) => value is not null ? new JsonValuePrimitive<string>(value, JsonMetadataServices.StringConverter!, options) : null;
231
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
233
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
235
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
237
public static
JsonValue
Create(ushort value, JsonNodeOptions? options = null) => new JsonValuePrimitive<ushort>(value, JsonMetadataServices.UInt16Converter, options);
240
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
242
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
244
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
246
public static
JsonValue
? Create(ushort? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<ushort>(value.Value, JsonMetadataServices.UInt16Converter, options) : null;
249
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
251
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
253
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
255
public static
JsonValue
Create(uint value, JsonNodeOptions? options = null) => new JsonValuePrimitive<uint>(value, JsonMetadataServices.UInt32Converter, options);
258
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
260
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
262
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
264
public static
JsonValue
? Create(uint? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<uint>(value.Value, JsonMetadataServices.UInt32Converter, options) : null;
267
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
269
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
271
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
273
public static
JsonValue
Create(ulong value, JsonNodeOptions? options = null) => new JsonValuePrimitive<ulong>(value, JsonMetadataServices.UInt64Converter, options);
276
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
278
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
280
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
282
public static
JsonValue
? Create(ulong? value, JsonNodeOptions? options = null) => value.HasValue ? new JsonValuePrimitive<ulong>(value.Value, JsonMetadataServices.UInt64Converter, options) : null;
285
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
287
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
289
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
290
public static
JsonValue
? Create(JsonElement value, JsonNodeOptions? options = null) =>
JsonValue
.CreateFromElement(ref value, options);
293
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
295
/// <param name="value">The underlying value of the new <see cref="
JsonValue
"/> instance.</param>
297
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
298
public static
JsonValue
? Create(JsonElement? value, JsonNodeOptions? options = null) => value is JsonElement element ?
JsonValue
.CreateFromElement(ref element, options) : null;
System\Text\Json\Nodes\JsonValue.cs (12)
29
/// The underlying value of a <see cref="
JsonValue
"/> after deserialization is an instance of <see cref="JsonElement"/>,
30
/// otherwise it's the value specified when the <see cref="
JsonValue
"/> was created.
39
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
42
/// The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
47
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
50
public static
JsonValue
? Create<T>(T? value, JsonNodeOptions? options = null)
72
/// Initializes a new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
75
/// The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.
81
/// <returns>The new instance of the <see cref="
JsonValue
"/> class that contains the specified value.</returns>
82
public static
JsonValue
? Create<T>(T? value, JsonTypeInfo<T> jsonTypeInfo, JsonNodeOptions? options = null)
161
internal static
JsonValue
CreateFromTypeInfo<T>(T value, JsonTypeInfo<T> jsonTypeInfo, JsonNodeOptions? options = null)
178
internal static
JsonValue
? CreateFromElement(ref readonly JsonElement element, JsonNodeOptions? options = null)
System\Text\Json\Nodes\JsonValueOfElement.cs (1)
30
if (otherNode is
JsonValue
)
System\Text\Json\Nodes\JsonValueOfJsonPrimitive.cs (1)
14
internal static
JsonValue
CreatePrimitiveValue(ref Utf8JsonReader reader, JsonNodeOptions options)
System\Text\Json\Nodes\JsonValueOfTPrimitive.cs (1)
32
if (otherNode is
JsonValue
otherValue && otherValue.TryGetValue(out TValue? v))
System\Text\Json\Serialization\Converters\Node\JsonNodeConverterFactory.cs (1)
18
if (typeof(
JsonValue
).IsAssignableFrom(typeToConvert))
System\Text\Json\Serialization\Converters\Node\JsonValueConverter.cs (5)
10
internal sealed class JsonValueConverter : JsonConverter<
JsonValue
?>
12
public override void Write(Utf8JsonWriter writer,
JsonValue
? value, JsonSerializerOptions options)
23
public override
JsonValue
? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
39
return
JsonValue
.CreateFromElement(ref element, options.GetNodeOptions());
43
internal static
JsonValue
ReadNonNullPrimitiveValue(ref Utf8JsonReader reader, JsonNodeOptions options)
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (1)
511
if (jsonNode is
JsonValue
jsonValue &&
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (1)
144
public static JsonConverter<
JsonValue
?> JsonValueConverter => field ??= new JsonValueConverter();