JsonObject
JsonObject
JsonObject
JsonObject
Class
Definition
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.
In This Article
public : sealed class JsonObject : IJsonObject, IJsonObjectWithDefaultValues, IJsonValue, IIterable<IKeyValuePair<Platform::String, IJsonValue>>, IMap<Platform::String, IJsonValue>, IStringable
struct winrt::Windows::Data::Json::JsonObject : IJsonObject, IJsonObjectWithDefaultValues, IJsonValue, IIterable<IKeyValuePair<Platform::String, IJsonValue>>, IMap<Platform::String, IJsonValue>, IStringable
public sealed class JsonObject : IJsonObject, IJsonObjectWithDefaultValues, IJsonValue, IEnumerable<KeyValuePair<String, IJsonValue>>, IDictionary<String, IJsonValue>, IStringable
Public NotInheritable Class JsonObject Implements IJsonObject, IJsonObjectWithDefaultValues, IJsonValue, IEnumerable<KeyValuePair<String, IJsonValue>>, IDictionary<String, IJsonValue>, IStringable
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Remarks
For an example of how these class methods are used to parse an object from a JSON string and convert it into a JsonObject object, update the name/value pairs the object contains, and then serialize the updated JsonObject object as a JSON string, see Using JavaScript Object Notation (JSON) .
Constructors
Properties
Methods
Add(TKey, TValue)
Add(TKey, TValue)
Add(TKey, TValue)
Add(TKey, TValue)
Adds an element with the provided key and value to the System.Collections.Generic.IDictionary`2 .
Clear()
Clear()
Clear()
Clear()
Removes all items from the collection.
ContainsKey(TKey)
ContainsKey(TKey)
ContainsKey(TKey)
ContainsKey(TKey)
Determines whether the System.Collections.Generic.IDictionary`2 contains an element with the specified key.
First()
First()
First()
First()
Returns the iterator for iteration over the key/value pairs in the JsonObject .
GetArray()
GetArray()
GetArray()
GetArray()
Returns a JsonArray if the ValueType of the encapsulated value is Array .
GetBoolean()
GetBoolean()
GetBoolean()
GetBoolean()
Gets a Boolean if the ValueType of the encapsulated value is Boolean .
GetEnumerator()
GetEnumerator()
GetEnumerator()
GetEnumerator()
Returns an enumerator that iterates through the collection.
GetNamedArray(String)
GetNamedArray(String)
GetNamedArray(String)
GetNamedArray(String)
Gets the JsonArray value with the specified name.
GetNamedArray(String, JsonArray)
GetNamedArray(String, JsonArray)
GetNamedArray(String, JsonArray)
GetNamedArray(String, JsonArray)
Gets the JsonArray value with the specified name, or the provided default value if no such named value is found.
GetNamedBoolean(String)
GetNamedBoolean(String)
GetNamedBoolean(String)
GetNamedBoolean(String)
Gets the Boolean value with the specified name.
GetNamedBoolean(String, Boolean)
GetNamedBoolean(String, Boolean)
GetNamedBoolean(String, Boolean)
GetNamedBoolean(String, Boolean)
Gets the Boolean value with the specified name, or the provided default value if no such named value is found.
GetNamedNumber(String)
GetNamedNumber(String)
GetNamedNumber(String)
GetNamedNumber(String)
Gets the number value (a Double ) with the specified name.
GetNamedNumber(String, Double)
GetNamedNumber(String, Double)
GetNamedNumber(String, Double)
GetNamedNumber(String, Double)
Gets the number value (a Double ) with the specified name, or the provided default value if no such named value is found.
GetNamedObject(String)
GetNamedObject(String)
GetNamedObject(String)
GetNamedObject(String)
Gets the JsonObject value with the specified name.
GetNamedObject(String, JsonObject)
GetNamedObject(String, JsonObject)
GetNamedObject(String, JsonObject)
GetNamedObject(String, JsonObject)
Gets the JsonObject value with the specified name, or the provided default value if no such named value is found.
GetNamedString(String)
GetNamedString(String)
GetNamedString(String)
GetNamedString(String)
Gets the String value with the specified name.
GetNamedString(String, String)
GetNamedString(String, String)
GetNamedString(String, String)
GetNamedString(String, String)
Gets the String value with the specified name, or the provided default value if no such named value is found.
GetNamedValue(String)
GetNamedValue(String)
GetNamedValue(String)
GetNamedValue(String)
Gets the JsonValue value with the specified name.
GetNamedValue(String, JsonValue)
GetNamedValue(String, JsonValue)
GetNamedValue(String, JsonValue)
GetNamedValue(String, JsonValue)
Gets the specified JsonValue value, or the provided default value if no such named value is found.
GetNumber()
GetNumber()
GetNumber()
GetNumber()
Gets the number (a Double ) if the ValueType of the encapsulated value is Number .
GetObject()
GetObject()
GetObject()
GetObject()
Gets the JsonObject if the ValueType of the encapsulated value is Object .
GetString()
GetString()
GetString()
GetString()
Gets the String if the ValueType of the encapsulated value is String .
GetView()
GetView()
GetView()
GetView()
Gets a JsonObject view.
HasKey(String)
HasKey(String)
HasKey(String)
HasKey(String)
Indicates whether the JsonObject has an entry with the requested key.
Insert(String, IJsonValue)
Insert(String, IJsonValue)
Insert(String, IJsonValue)
Insert(String, IJsonValue)
Adds a new entry to the JsonObject .
Lookup(String)
Lookup(String)
Lookup(String)
Lookup(String)
Gets the JSON value associated with the supplied key, if an entry with that key exists.
Parse(String)
Parse(String)
Parse(String)
Parse(String)
Parses the specified JSON string that represents a JsonObject into a JSON value.
Note
This 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 JsonObject .
Remove(T)
Remove(T)
Remove(T)
Remove(T)
Removes the element with the specified key from the System.Collections.Generic.IDictionary`2 .
Remove(String)
Remove(String)
Remove(String)
Remove(String)
Removes a specific item from the JsonObject .
SetNamedValue(String, IJsonValue)
SetNamedValue(String, IJsonValue)
SetNamedValue(String, IJsonValue)
SetNamedValue(String, IJsonValue)
Sets the value of the first JsonValue object with the specified name to the specified value. If no such object is found, a new name and JsonValue pair is inserted into the JSON object.
Stringify()
Stringify()
Stringify()
Stringify()
Retrieves the JSON representation of the encapsulated value.
ToString()
ToString()
ToString()
ToString()
Retrieves the JSON representation of the encapsulated value.
TryGetValue(TKey, out TValue)
TryGetValue(TKey, out TValue)
TryGetValue(TKey, out TValue)
TryGetValue(TKey, out TValue)
Gets the value associated with the specified key.
TryParse(String, JsonObject)
TryParse(String, JsonObject)
TryParse(String, JsonObject)
TryParse(String, JsonObject)
Parses the specified string that represents a JSON object into a JsonObject .
See Also