Dela via


JsonObject.GetNamedValue Method

Definition

Overloads

GetNamedValue(String, JsonValue)

Gets the specified JsonValue value, or the provided default value if no such named value is found.

GetNamedValue(String)

Gets the JsonValue value with the specified name.

GetNamedValue(String, JsonValue)

Gets the specified JsonValue value, or the provided default value if no such named value is found.

public:
 virtual JsonValue ^ GetNamedValue(Platform::String ^ name, JsonValue ^ defaultValue) = GetNamedValue;
/// [Windows.Foundation.Metadata.Overload("GetNamedValueOrDefault")]
JsonValue GetNamedValue(winrt::hstring const& name, JsonValue const& defaultValue);
[Windows.Foundation.Metadata.Overload("GetNamedValueOrDefault")]
public JsonValue GetNamedValue(string name, JsonValue defaultValue);
function getNamedValue(name, defaultValue)
Public Function GetNamedValue (name As String, defaultValue As JsonValue) As JsonValue

Parameters

name
String

Platform::String

winrt::hstring

The name.

defaultValue
JsonValue

The default value to use if the JSON property is not found.

Returns

The JsonValue with the specified name, or if this value wasn't found, the defaultValue is returned.

Attributes

See also

Applies to

GetNamedValue(String)

Gets the JsonValue value with the specified name.

public:
 virtual JsonValue ^ GetNamedValue(Platform::String ^ name) = GetNamedValue;
JsonValue GetNamedValue(winrt::hstring const& name);
public JsonValue GetNamedValue(string name);
function getNamedValue(name)
Public Function GetNamedValue (name As String) As JsonValue

Parameters

name
String

Platform::String

winrt::hstring

The name.

Returns

The JsonValue value with the specified name.

Remarks

This method should always used with a try/catch block because it throws an exception if the name found is not a JsonValue type or the name is not found.

See also

Applies to