JsonValue JsonValue JsonValue JsonValue Class

Definition

Implements the IJsonValue interface which represents a JSON value.

A JsonValue object can represent the three primitive JSON value types of Boolean, Number and String, and can also represent the complex value types of Array and Object by providing ways to access them.

public : sealed class JsonValue : IJsonValue, IStringable
struct winrt::Windows::Data::Json::JsonValue : IJsonValue, IStringable
public sealed class JsonValue : IJsonValue, IStringable
Public NotInheritable Class JsonValue Implements IJsonValue, IStringable
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

A JsonValue object has overloaded constructors to instantiate a new object from a JSON String, Number or Boolean value and a default constructor that instantiates a JsonValue object with a ValueType of NULL.

For an example of how these class methods are used to parse a number or string from a JSON string and convert it into a JsonValue object, see Using JavaScript Object Notation (JSON).

Properties

ValueType ValueType ValueType ValueType

Gets the type of the encapsulated JSON value. Possible types are defined by JsonValueType.

Methods

CreateBooleanValue(Boolean) CreateBooleanValue(Boolean) CreateBooleanValue(Boolean) CreateBooleanValue(Boolean)

Creates a JsonValue from a Boolean.

CreateNullValue() CreateNullValue() CreateNullValue() CreateNullValue()

Creates a JsonValue with a NULL value.

CreateNumberValue(Double) CreateNumberValue(Double) CreateNumberValue(Double) CreateNumberValue(Double)

Creates a JsonValue from a Number (Double).

CreateStringValue(String) CreateStringValue(String) CreateStringValue(String) CreateStringValue(String)

Creates the string for a JsonValue.

GetArray() GetArray() GetArray() GetArray()

Gets an array if the ValueType of the encapsulated value is Array.

GetBoolean() GetBoolean() GetBoolean() GetBoolean()

Gets the Boolean if the ValueType of the encapsulated value is Boolean.

GetNumber() GetNumber() GetNumber() GetNumber()

Gets the number (a Double) if the ValueType of the encapsulated value is Number.

GetObject() GetObject() GetObject() GetObject()

Gets a JsonObject if the ValueType of the encapsulated value is Object.

GetString() GetString() GetString() GetString()

Gets a String if the ValueType of the encapsulated value is String.

Parse(String) Parse(String) Parse(String) Parse(String)

Parses the specified JSON string into a JsonValue.

Note

This method will throw an exception if the provided JSON string is not valid. Use of JsonObject.TryParse is a recommended alternative. A TryParse call will return a boolean value to indicate success or failure and, if successful, the resultant JsonValue.

Stringify() Stringify() Stringify() Stringify()

Retrieves the JSON representation of the encapsulated value.

ToString() ToString() ToString() ToString()

Retrieves the JSON representation of the encapsulated value.

TryParse(String, JsonValue) TryParse(String, JsonValue) TryParse(String, JsonValue) TryParse(String, JsonValue)

Parses the specified string into a JsonValue.

See also