JsonValue Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
This is the abstract base class for JavaScript Object Notation (JSON) common language runtime (CLR) types.
Inheritance Hierarchy
System.Object
System.Json.JsonValue
System.Json.JsonArray
System.Json.JsonObject
System.Json.JsonPrimitive
Namespace: System.Json
Assembly: System.Json (in System.Json.dll)
Syntax
'Declaration
<DefaultMemberAttribute("Item")> _
Public MustInherit Class JsonValue _
Implements IEnumerable
[DefaultMemberAttribute("Item")]
public abstract class JsonValue : IEnumerable
The JsonValue type exposes the following members.
Properties
Name | Description | |
---|---|---|
Count | This method is not supported and throws an exception when called. | |
Item[Int32] | This indexer is not supported for this base class and throws an exception. | |
Item[String] | This indexer is not supported for this base class and throws an exception. | |
JsonType | When implemented in a derived class, indicates the JSON CLR type represented by the derived type. |
Top
Methods
Name | Description | |
---|---|---|
ContainsKey | Throws an InvalidOperationException. | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Load(Stream) | Deserializes text-based JSON from a stream into a JSON CLR type. | |
Load(TextReader) | Deserializes text-based JSON from a text reader into a JSON CLR type. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Parse | Deserializes text-based JSON into a JSON CLR type. | |
Save(Stream) | When implemented in a derived class, serializes the JsonValue CLR type into text-based JSON using a stream. | |
Save(TextWriter) | Serializes the JsonValue CLR type into text-based JSON using a text writer. | |
ToString | Saves (serializes) this JSON CLR type into text-based JSON. (Overrides Object.ToString().) |
Top
Operators
Name | Description | |
---|---|---|
Implicit(Boolean to JsonValue) | Enables implicit casts from type Boolean to a JsonPrimitive. | |
Implicit(Byte to JsonValue) | Enables implicit casts from type Byte to a JsonPrimitive. | |
Implicit(Char to JsonValue) | Enables implicit casts from type Char to a JsonPrimitive. | |
Implicit(DateTime to JsonValue) | Enables implicit casts from type DateTime to a JsonPrimitive. | |
Implicit(DateTimeOffset to JsonValue) | Enables implicit casts from type DateTimeOffset to a JsonObject. | |
Implicit(Decimal to JsonValue) | Enables implicit casts from type Decimal to a JsonPrimitive. | |
Implicit(Double to JsonValue) | Enables implicit casts from type Double to a JsonPrimitive. | |
Implicit(Guid to JsonValue) | Enables implicit casts from type Guid to a JsonPrimitive. | |
Implicit(Int16 to JsonValue) | Enables implicit casts from type Int16 to a JsonPrimitive. | |
Implicit(Int32 to JsonValue) | Enables implicit casts from type Int32 to a JsonPrimitive. | |
Implicit(Int64 to JsonValue) | Enables implicit casts from type Int64 to a JsonPrimitive. | |
Implicit(JsonValue to DateTime) | Enables implicit casts from an instance of type JsonValue to a Datetime object. | |
Implicit(JsonValue to TimeSpan) | Enables implicit casts from an instance of type JsonValue to a TimeSpan object. | |
Implicit(JsonValue to Boolean) | Enables implicit casts from an instance of type JsonValue to a Boolean object. | |
Implicit(JsonValue to Char) | Enables implicit casts from an instance of type JsonValue to a Char object. | |
Implicit(JsonValue to Int64) | Enables implicit casts from an instance of type JsonValue to a Int64 object. | |
Implicit(JsonValue to Decimal) | Enables implicit casts from an instance of type JsonValue to a Decimal object. | |
Implicit(JsonValue to Int32) | Enables implicit casts from an instance of type JsonValue to a Int32 object. | |
Implicit(JsonValue to UInt64) | Enables implicit casts from an instance of type JsonValue to a UInt64 object. | |
Implicit(JsonValue to String) | Enables implicit casts from an instance of type JsonValue to a String object. | |
Implicit(JsonValue to DateTimeOffset) | Enables implicit casts from an instance of type JsonValue to a DateTimeOffset object. | |
Implicit(JsonValue to Single) | Enables implicit casts from an instance of type JsonValue to a Single object. | |
Implicit(JsonValue to Double) | Enables implicit casts from an instance of type JsonValue to a Double object. | |
Implicit(JsonValue to SByte) | Enables implicit casts from an instance of type JsonValue to a SByte object. | |
Implicit(JsonValue to Byte) | Enables implicit casts from an instance of type JsonValue to a Byte object. | |
Implicit(JsonValue to Uri) | Enables implicit casts from an instance of type JsonValue to a Uri object. | |
Implicit(JsonValue to UInt16) | Enables implicit casts from an instance of type JsonValue to a UInt16 object. | |
Implicit(JsonValue to UInt32) | Enables implicit casts from an instance of type JsonValue to a UInt32 object. | |
Implicit(JsonValue to Int16) | Enables implicit casts from an instance of type JsonValue to a Int16 object. | |
Implicit(JsonValue to Guid) | Enables implicit casts from an instance of type JsonValue to a Guid object. | |
Implicit(SByte to JsonValue) | Enables implicit casts from type SByte to a JsonPrimitive. | |
Implicit(Single to JsonValue) | Enables implicit casts from type Single to a JsonPrimitive. | |
Implicit(String to JsonValue) | Enables implicit casts from type String to a JsonPrimitive. | |
Implicit(TimeSpan to JsonValue) | Enables implicit casts from type Timespan to a JsonPrimitive. | |
Implicit(UInt16 to JsonValue) | Enables implicit casts from type UInt16 to a JsonPrimitive. | |
Implicit(UInt32 to JsonValue) | Enables implicit casts from type UInt32 to a JsonPrimitive. | |
Implicit(UInt64 to JsonValue) | Enables implicit casts from type UInt64 to a JsonPrimitive. | |
Implicit(Uri to JsonValue) | Enables implicit casts from type Uri to a JsonPrimitive. |
Top
Extension Methods
Name | Description | |
---|---|---|
AsQueryable | Converts an IEnumerable to an IQueryable. (Defined by Queryable.) | |
Cast<TResult> | Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.) | |
OfType<TResult> | Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
IEnumerable.GetEnumerator | This method is not supported for this base class and throws an exception. |
Top
Remarks
The JSON CLR types JsonPrimitive, JsonArray, and JsonObject all inherit from this base class. It contains functionality common to all JSON CLR types, which is accessed through abstract methods and inheritance from this type. In particular, it contains a set of Implicit() operations that supports implicit static type conversion that enables you to treat JSON in a weakly typed manner.
Note that you cannot create custom classes that derive from JsonValue because one of its abstract properties is internal. This means that only types like JsonPrimitive that are in the System.Json.dll are allowed to derive from the class.
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.