JsonValue Class
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.
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 ref class JsonValue sealed : IJsonValue, IStringable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class JsonValue final : IJsonValue, IStringable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class JsonValue : IJsonValue, IStringable
Public NotInheritable Class JsonValue
Implements IJsonValue, IStringable
- Inheritance
- Attributes
- Implements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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).
Value |
Gets the type of the encapsulated JSON value. Possible types are defined by JsonValueType. |
Create |
Creates a JsonValue from a Boolean. |
Create |
Creates a JsonValue with a NULL value. |
Create |
Creates a JsonValue from a Number (Double). |
Create |
Creates the string for a JsonValue. |
Get |
Gets an array if the ValueType of the encapsulated value is Array. |
Get |
Gets the Boolean if the ValueType of the encapsulated value is Boolean. |
Get |
Gets the number (a Double) if the ValueType of the encapsulated value is Number. |
Get |
Gets a JsonObject if the ValueType of the encapsulated value is Object. |
Get |
Gets a String if the ValueType of the encapsulated value is 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() |
Retrieves the JSON representation of the encapsulated value. |
To |
Retrieves the JSON representation of the encapsulated value. |
Try |
Parses the specified string into a JsonValue. |
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |