Skip to main content

Windows Dev Center

JsonValue class

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.

Syntax


public sealed class JsonValue : IJsonValue

Public NotInheritable Class JsonValue
    Implements IJsonValue

public ref class JsonValue sealed : IJsonValue

Members

The JsonValue class has these types of members:

Methods

The JsonValue class has these methods. It also inherits methods from the Object class.

MethodDescription
CreateBooleanValue Creates a JsonValue from a Boolean.
CreateNullValue Creates a JsonValue will a NULL value.
CreateNumberValue Creates a JsonValue from a Number (Double).
CreateStringValue Creates the string for a JsonValue.
GetArray Gets an array if the ValueType of the encapsulated value is Array.
GetBoolean Gets the Boolean if the ValueType of the encapsulated value is Boolean.
GetNumber Gets the number (a Double) if the ValueType of the encapsulated value is Number.
GetObject Gets a JsonObject if the ValueType of the encapsulated value is Object.
GetString Gets a String if the ValueType of the encapsulated value is String.
Parse Parses the specified JSON string into a JsonValue.
Stringify Retrieves the JSON representation of the encapsulated value.
ToString Retrieves the JSON representation of the encapsulated value.
TryParse Parses the specified string into a JsonValue.

 

Properties

The JsonValue class has these properties.

PropertyAccess typeDescription

ValueType

Read-onlyGets the type of the encapsulated JSON value. Possible types are defined by JsonValueType.

 

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).

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Data.Json
Windows::Data::Json [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Data.Json
Windows::Data::Json [C++]

Metadata

Windows.winmd

Attributes

[ DualApiPartition()]
[ MarshalingBehavior(Agile)]
[ Threading(Both)]
[ Version(0x06020000)]
[ WebHostHidden()]

See also

Object
IJsonValue
Using JavaScript Object Notation (JSON)
ValueType