1 type derived from JsonValue
System.Text.Json (1)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
11
internal abstract class JsonValue<TValue> :
JsonValue
253 references to JsonValue
Aspire.Dashboard (5)
Otlp\Model\OtlpHelpers.cs (5)
115
AnyValue.ValueOneofCase.StringValue =>
JsonValue
.Create(value.StringValue),
116
AnyValue.ValueOneofCase.IntValue =>
JsonValue
.Create(value.IntValue),
117
AnyValue.ValueOneofCase.DoubleValue =>
JsonValue
.Create(value.DoubleValue),
118
AnyValue.ValueOneofCase.BoolValue =>
JsonValue
.Create(value.BoolValue),
119
AnyValue.ValueOneofCase.BytesValue =>
JsonValue
.Create(value.BytesValue.ToHexString()),
Aspire.Hosting.Azure (1)
Provisioning\Provisioners\BicepProvisioner.cs (1)
500
IEnumerable<string> s => new JsonArray(s.Select(s =>
JsonValue
.Create(s)).ToArray()),
ConfigurationSchemaGenerator (1)
ConfigSchemaEmitter.cs (1)
738
public override bool CanConvert(Type typeToConvert) => typeof(JsonNode).IsAssignableFrom(typeToConvert) && typeToConvert != typeof(
JsonValue
);
dotnet-user-jwts (2)
Helpers\JwtAuthenticationSchemeSettings.cs (1)
24
[nameof(TokenValidationParameters.ValidAudiences)] = new JsonArray(Audiences.Select(aud =>
JsonValue
.Create(aud)).ToArray()),
Helpers\SigningKeysHandler.cs (1)
92
secrets.Add(signkingKeysPropertyName,
JsonValue
.Create(new[] { key }));
Microsoft.Extensions.AI (1)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
223
_ =>
JsonValue
.Create(element)
Microsoft.Extensions.AI.Abstractions.Tests (3)
test\Shared\JsonSchemaExporter\TestTypes.cs (3)
103
yield return new TestData<
JsonValue
>((
JsonValue
)42, "true");
1228
[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);
Shared (1)
JsonSchemaExporter\JsonSchemaExporter.cs (1)
631
[typeof(
JsonValue
)] = _ => JsonSchema.CreateTrueSchema(),
Shared.Tests (7)
JsonSchemaExporter\JsonSchemaExporterTests.cs (4)
61
JsonValue
type = Assert.IsAssignableFrom<
JsonValue
>(schema["type"]);
77
JsonValue
value = Assert.IsAssignableFrom<
JsonValue
>(schema["type"]);
JsonSchemaExporter\TestTypes.cs (3)
103
yield return new TestData<
JsonValue
>((
JsonValue
)42, "true");
1228
[JsonSerializable(typeof(
JsonValue
))]
System.Text.Json (223)
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)]
391
if (Value is
JsonValue
)
System\Text\Json\Nodes\JsonNode.cs (18)
95
/// Casts to the derived <see cref="
JsonValue
"/> type.
98
/// A <see cref="
JsonValue
"/>.
101
/// The node is not a <see cref="
JsonValue
"/>.
103
public
JsonValue
AsValue()
105
JsonValue
? jValue = this as
JsonValue
;
109
ThrowHelper.ThrowInvalidOperationException_NodeWrongType(nameof(
JsonValue
));
177
/// Gets the value for the current <see cref="
JsonValue
"/>.
179
/// <typeparam name="T">The type of the value to obtain from the <see cref="
JsonValue
"/>.</typeparam>
180
/// <returns>A value converted from the <see cref="
JsonValue
"/> instance.</returns>
186
/// The underlying value of a <see cref="
JsonValue
"/> after deserialization is an instance of <see cref="JsonElement"/>,
187
/// otherwise it's the value specified when the <see cref="
JsonValue
"/> was created.
189
/// <seealso cref="System.Text.Json.Nodes.
JsonValue
.TryGetValue"></seealso>
194
/// The current <see cref="JsonNode"/> is not a <see cref="
JsonValue
"/> or
198
throw new InvalidOperationException(SR.Format(SR.NodeWrongType, nameof(
JsonValue
)));
326
[RequiresUnreferencedCode(
JsonValue
.CreateUnreferencedCodeMessage)]
327
[RequiresDynamicCode(
JsonValue
.CreateDynamicCodeMessage)]
390
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)
45
if (this is
JsonValue
)
System\Text\Json\Nodes\JsonObject.cs (2)
176
case
JsonValue
value:
352
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 != 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)
164
internal static
JsonValue
CreateFromTypeInfo<T>(T value, JsonTypeInfo<T> jsonTypeInfo, JsonNodeOptions? options = null)
181
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\JsonValueOfTPrimitive.cs (1)
32
if (otherNode is
JsonValue
otherValue && otherValue.TryGetValue(out TValue? v))
System\Text\Json\Serialization\Converters\Node\JsonNodeConverterFactory.cs (1)
14
if (typeof(
JsonValue
).IsAssignableFrom(typeToConvert))
System\Text\Json\Serialization\Converters\Node\JsonValueConverter.cs (4)
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)
31
return
JsonValue
.CreateFromElement(ref element, options.GetNodeOptions());
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (1)
465
if (jsonNode is
JsonValue
jsonValue &&
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (2)
160
public static JsonConverter<
JsonValue
?> JsonValueConverter => s_jsonValueConverter ??= new JsonValueConverter();
161
private static JsonConverter<
JsonValue
?>? s_jsonValueConverter;