Sdílet prostřednictvím


Windows.Data.Json Namespace

Provides support for JSON arrays, values, and objects.

Classes

JsonArray

Represents a JSON array.

JsonArray inherits the IVector(IJsonValue) and IIterable(IJsonValue) interfaces, which provide methods to iterate through the elements in the array and update its contents.

JsonError

Represents an error encountered while parsing JSON data.

JsonObject

Represents a JSON object containing a collection of name and JsonValue pairs.

JsonObject is an activatable class that implements JsonValue and the IMap<String,IJsonValue> interface such that its name/value pairs can be manipulated like a dictionary. When there are values with duplicated names, the last name/value pair will be stored.

JsonValue

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.

Interfaces

IJsonValue

Encapsulates a JSON value.

Enums

JsonErrorStatus

Defines errors encountered while parsing JSON data.

JsonValueType

Specifies the JSON value type of a JsonValue object.

Examples

string jsonString = await FileIO.ReadTextAsync(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/MyData.json")));
var rootObject = JsonObject.Parse(jsonString);
System.Diagnostics.Debug.WriteLine(rootObject["myJsonProperty"]);

See also