Export (0) Print
Expand All

JsonValue Class

This is the abstract base class for JavaScript Object Notation (JSON) common language runtime (CLR) types.

Namespace:  System.Json
Assembly:  System.Json (in System.Json.dll)

[DefaultMemberAttribute("Item")]
public abstract class JsonValue : IEnumerable

The JsonValue type exposes the following members.

  NameDescription
Public propertyCountThis method is not supported and throws an exception when called.
Public propertyItem[Int32]This indexer is not supported for this base class and throws an exception.
Public propertyItem[String]This indexer is not supported for this base class and throws an exception.
Public propertyJsonTypeWhen implemented in a derived class, indicates the JSON CLR type represented by the derived type.
Top

  NameDescription
Public methodContainsKeyThrows an InvalidOperationException.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberLoad(Stream)Deserializes text-based JSON from a stream into a JSON CLR type.
Public methodStatic memberLoad(TextReader)Deserializes text-based JSON from a text reader into a JSON CLR type.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberParseDeserializes text-based JSON into a JSON CLR type.
Public methodSave(Stream)When implemented in a derived class, serializes the JsonValue CLR type into text-based JSON using a stream.
Public methodSave(TextWriter)Serializes the JsonValue CLR type into text-based JSON using a text writer.
Public methodToStringSaves (serializes) this JSON CLR type into text-based JSON. (Overrides Object.ToString().)
Top

  NameDescription
Public operatorStatic memberImplicit(Boolean to JsonValue)Enables implicit casts from type Boolean to a JsonPrimitive.
Public operatorStatic memberImplicit(Byte to JsonValue)Enables implicit casts from type Byte to a JsonPrimitive.
Public operatorStatic memberImplicit(Char to JsonValue)Enables implicit casts from type Char to a JsonPrimitive.
Public operatorStatic memberImplicit(DateTime to JsonValue)Enables implicit casts from type DateTime to a JsonPrimitive.
Public operatorStatic memberImplicit(DateTimeOffset to JsonValue)Enables implicit casts from type DateTimeOffset to a JsonObject.
Public operatorStatic memberImplicit(Decimal to JsonValue)Enables implicit casts from type Decimal to a JsonPrimitive.
Public operatorStatic memberImplicit(Double to JsonValue)Enables implicit casts from type Double to a JsonPrimitive.
Public operatorStatic memberImplicit(Guid to JsonValue)Enables implicit casts from type Guid to a JsonPrimitive.
Public operatorStatic memberImplicit(Int16 to JsonValue)Enables implicit casts from type Int16 to a JsonPrimitive.
Public operatorStatic memberImplicit(Int32 to JsonValue)Enables implicit casts from type Int32 to a JsonPrimitive.
Public operatorStatic memberImplicit(Int64 to JsonValue)Enables implicit casts from type Int64 to a JsonPrimitive.
Public operatorStatic memberImplicit(JsonValue to DateTime)Enables implicit casts from an instance of type JsonValue to a Datetime object.
Public operatorStatic memberImplicit(JsonValue to TimeSpan)Enables implicit casts from an instance of type JsonValue to a TimeSpan object.
Public operatorStatic memberImplicit(JsonValue to Boolean)Enables implicit casts from an instance of type JsonValue to a Boolean object.
Public operatorStatic memberImplicit(JsonValue to Char)Enables implicit casts from an instance of type JsonValue to a Char object.
Public operatorStatic memberImplicit(JsonValue to Int64)Enables implicit casts from an instance of type JsonValue to a Int64 object.
Public operatorStatic memberImplicit(JsonValue to Decimal)Enables implicit casts from an instance of type JsonValue to a Decimal object.
Public operatorStatic memberImplicit(JsonValue to Int32)Enables implicit casts from an instance of type JsonValue to a Int32 object.
Public operatorStatic memberImplicit(JsonValue to UInt64)Enables implicit casts from an instance of type JsonValue to a UInt64 object.
Public operatorStatic memberImplicit(JsonValue to String)Enables implicit casts from an instance of type JsonValue to a String object.
Public operatorStatic memberImplicit(JsonValue to DateTimeOffset)Enables implicit casts from an instance of type JsonValue to a DateTimeOffset object.
Public operatorStatic memberImplicit(JsonValue to Single)Enables implicit casts from an instance of type JsonValue to a Single object.
Public operatorStatic memberImplicit(JsonValue to Double)Enables implicit casts from an instance of type JsonValue to a Double object.
Public operatorStatic memberImplicit(JsonValue to SByte)Enables implicit casts from an instance of type JsonValue to a SByte object.
Public operatorStatic memberImplicit(JsonValue to Byte)Enables implicit casts from an instance of type JsonValue to a Byte object.
Public operatorStatic memberImplicit(JsonValue to Uri)Enables implicit casts from an instance of type JsonValue to a Uri object.
Public operatorStatic memberImplicit(JsonValue to UInt16)Enables implicit casts from an instance of type JsonValue to a UInt16 object.
Public operatorStatic memberImplicit(JsonValue to UInt32)Enables implicit casts from an instance of type JsonValue to a UInt32 object.
Public operatorStatic memberImplicit(JsonValue to Int16)Enables implicit casts from an instance of type JsonValue to a Int16 object.
Public operatorStatic memberImplicit(JsonValue to Guid)Enables implicit casts from an instance of type JsonValue to a Guid object.
Public operatorStatic memberImplicit(SByte to JsonValue)Enables implicit casts from type SByte to a JsonPrimitive.
Public operatorStatic memberImplicit(Single to JsonValue)Enables implicit casts from type Single to a JsonPrimitive.
Public operatorStatic memberImplicit(String to JsonValue)Enables implicit casts from type String to a JsonPrimitive.
Public operatorStatic memberImplicit(TimeSpan to JsonValue)Enables implicit casts from type Timespan to a JsonPrimitive.
Public operatorStatic memberImplicit(UInt16 to JsonValue)Enables implicit casts from type UInt16 to a JsonPrimitive.
Public operatorStatic memberImplicit(UInt32 to JsonValue)Enables implicit casts from type UInt32 to a JsonPrimitive.
Public operatorStatic memberImplicit(UInt64 to JsonValue)Enables implicit casts from type UInt64 to a JsonPrimitive.
Public operatorStatic memberImplicit(Uri to JsonValue)Enables implicit casts from type Uri to a JsonPrimitive.
Top

  NameDescription
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top

  NameDescription
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorThis method is not supported for this base class and throws an exception.
Top

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.

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft