JsonElement.GetProperty Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
GetProperty(ReadOnlySpan<Byte>) |
Gets a JsonElement representing the value of a required property identified by |
GetProperty(ReadOnlySpan<Char>) |
Gets a JsonElement representing the value of a required property identified by |
GetProperty(String) |
Gets a JsonElement representing the value of a required property identified by |
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
Gets a JsonElement representing the value of a required property identified by utf8PropertyName
.
public:
System::Text::Json::JsonElement GetProperty(ReadOnlySpan<System::Byte> utf8PropertyName);
public System.Text.Json.JsonElement GetProperty (ReadOnlySpan<byte> utf8PropertyName);
member this.GetProperty : ReadOnlySpan<byte> -> System.Text.Json.JsonElement
Public Function GetProperty (utf8PropertyName As ReadOnlySpan(Of Byte)) As JsonElement
Parameters
- utf8PropertyName
- ReadOnlySpan<Byte>
The UTF-8 representation (with no Byte-Order-Mark (BOM)) of the name of the property to return.
Returns
A JsonElement representing the value of the requested property.
Exceptions
No property was found with the requested name.
The parent JsonDocument has been disposed.
Remarks
Property name matching is performed as an ordinal, case-sensitive comparison.
If a property is defined multiple times for the same object, the method matches the last such definition.
For more information, see How to write custom serializers and deserializers with System.Text.Json.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
Gets a JsonElement representing the value of a required property identified by propertyName
.
public:
System::Text::Json::JsonElement GetProperty(ReadOnlySpan<char> propertyName);
public System.Text.Json.JsonElement GetProperty (ReadOnlySpan<char> propertyName);
member this.GetProperty : ReadOnlySpan<char> -> System.Text.Json.JsonElement
Public Function GetProperty (propertyName As ReadOnlySpan(Of Char)) As JsonElement
Parameters
- propertyName
- ReadOnlySpan<Char>
The name of the property whose value is to be returned.
Returns
A JsonElement representing the value of the requested property.
Exceptions
No property was found with the requested name.
The parent JsonDocument has been disposed.
Remarks
Property name matching is performed as an ordinal, case-sensitive comparison.
If a property is defined multiple times for the same object, the method matches the last such definition.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
Gets a JsonElement representing the value of a required property identified by propertyName
.
public:
System::Text::Json::JsonElement GetProperty(System::String ^ propertyName);
public System.Text.Json.JsonElement GetProperty (string propertyName);
member this.GetProperty : string -> System.Text.Json.JsonElement
Public Function GetProperty (propertyName As String) As JsonElement
Parameters
- propertyName
- String
The name of the property whose value is to be returned.
Returns
A JsonElement representing the value of the requested property.
Exceptions
No property was found with the requested name.
propertyName
is null
.
The parent JsonDocument has been disposed.
Remarks
Property name matching is performed as an ordinal, case-sensitive comparison.
If a property is defined multiple times for the same object, the method matches the last such definition.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: