Interface IJSONDocument
This interface provides implementation for the JsonDocument class to examine the structural content of a JSON value.
Inherited Members
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
public interface IJSONDocument : ICloneable, IComparable, IEnumerable<KeyValuePair<string, object>>, IEnumerable, ICompactSerializable
Properties
Count
Attribute count of IJSONDocument.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Attribute count of IJSONDocument. |
Item[String]
Gets/Sets the value of the specified attribute.
Declaration
object this[string attribute] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Property Value
Type | Description |
---|---|
System.Object | Value of the specified attribute. |
Size
Size of the IJSONDocument.
Declaration
long Size { get; }
Property Value
Type | Description |
---|---|
System.Int64 | Size of the IJSONDocument. |
Methods
Add(String, IJSONDocument)
Adds an IJSONDocument object as a IJSONDocument attribute value.
Declaration
void Add(string attribute, IJSONDocument value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
IJSONDocument | value | JSON value. |
Add(String, Array)
Adds System.Array object as IJSONDocument attribute value.
Declaration
void Add(string attribute, Array value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Array | value | JSON value. |
Add(String, Boolean)
Adds boolean value as IJSONDocument attribute value.
Declaration
void Add(string attribute, bool value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Boolean | value | JSON value. |
Add(String, DateTime)
Adds System.DateTime object as IJSONDocument attribute value.
Declaration
void Add(string attribute, DateTime value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.DateTime | value | JSON value. |
Add(String, Double)
Adds double value as IJSONDocument attribute value.
Declaration
void Add(string attribute, double value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Double | value | JSON value. |
Add(String, Int16)
Adds short value as IJSONDocument attribute value.
Declaration
void Add(string attribute, short value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Int16 | value | JSON value. |
Add(String, Int32)
Adds integer value as IJSONDocument attribute value.
Declaration
void Add(string attribute, int value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Int32 | value | JSON value. |
Add(String, Int64)
Adds long value as IJSONDocument attribute value.
Declaration
void Add(string attribute, long value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Int64 | value | JSON value. |
Add(String, Object)
Adds System.Object as IJSONDocument attribute value.
Declaration
void Add(string attribute, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Object | value | JSON value. |
Add(String, Single)
Adds float value as IJSONDocument attribute value.
Declaration
void Add(string attribute, float value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Single | value | JSON value. |
Add(String, String)
Adds System.String object as IJSONDocument attribute value.
Declaration
void Add(string attribute, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.String | value | JSON value. |
Clear()
Removes all attributes that exist for IJSONDocument.
Declaration
void Clear()
Contains(String)
Checks for containement of attribute in IJSONDocument.
Declaration
bool Contains(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Boolean | True if the IJSONDocument contains an attribute with the specified name; otherwise, false. |
Get<T>(String)
Gets the value of the specified attribute of specified type.
Declaration
T Get<T>(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
T | Value of the specified attribute as specified by type. |
Type Parameters
Name | Description |
---|---|
T | Specifies the type of attribute value to be obtained from IJSONDocument. |
GetArray<T>(String)
Gets the value of the specified attribute as array of specified type.
Declaration
T[] GetArray<T>(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
T[] | Value of the specified attribute as array. |
Type Parameters
Name | Description |
---|---|
T | Specifies the type of attribute value to be obtained from IJSONDocument. |
GetAsDecimal(String)
Get the value of the specified attribute as decimal.
Declaration
decimal GetAsDecimal(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Decimal | Decimal value of the specified attribute. |
GetAsDouble(String)
Gets the value of the specified attribute as double.
Declaration
double GetAsDouble(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Double | Double value of the specified attribute. |
GetAsFloat(String)
Gets the value of the specified attribute as float.
Declaration
float GetAsFloat(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Single | Float value of the specified attribute. |
GetAsInt16(String)
Gets the value of specified attribute as short.
Declaration
short GetAsInt16(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Int16 | Short value of the specified attribute. |
GetAsInt32(String)
Gets the value of the specified attribute as integer.
Declaration
int GetAsInt32(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Int32 | Integer value of the specified attribute. |
GetAsInt64(String)
Gets the value of the specified attribute as long.
Declaration
long GetAsInt64(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Int64 | Long value of the specified attribute. |
GetAsString(String)
Gets the value of the specified attribute as string.
Declaration
string GetAsString(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.String | String value of the specified attribute. |
GetAttributeDataType(String)
Gets the JsonDataType of the value of specified attribute.
Declaration
JsonDataType GetAttributeDataType(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
JsonDataType | The datatype of value of attribute. |
GetAttributes()
Gets all attributes that exist for the IJSONDocument.
Declaration
ICollection<string> GetAttributes()
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<System.String> | The retreived attributes as collection. |
GetBoolean(String)
Gets the value of the specified attribute as boolean.
Declaration
bool GetBoolean(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean value of the specified attribute. |
GetDateTime(String)
Gets the value of the specified attribute as System.DateTime.
Declaration
DateTime GetDateTime(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.DateTime | System.DateTime value of the specified attribute. |
GetDocument(String)
Gets the value of the specified attribute as IJSONDocument.
Declaration
IJSONDocument GetDocument(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
IJSONDocument | IJSONDocument value of the specified attribute. |
GetString(String)
Gets the value of the specified attribute as string.
Declaration
string GetString(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
Returns
Type | Description |
---|---|
System.String | String value of the specified attribute. |
Parse<T>()
Parses the IJSONDocument object into the specified type object.
Declaration
T Parse<T>()
Returns
Type | Description |
---|---|
T | Parsed object of specified type. |
Type Parameters
Name | Description |
---|---|
T | Type of the object. |
Remove(String)
Removes the specified attribute from IJSONDocument.
Declaration
void Remove(string attribute)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
TryGet(String, out Object)
Gets the value of the specified attribute if it exists in IJSONDocument.
Declaration
bool TryGet(string attribute, out object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
System.Object | value | Out parameter through which the obtained item is returned. |
Returns
Type | Description |
---|---|
System.Boolean | True if the IJSONDocument contains the specified attribute; otherwise, false. |
TryGet<T>(String, out T)
Gets the value of the specified attribute if it exists in IJSONDocument.
Declaration
bool TryGet<T>(string attribute, out T value)
Parameters
Type | Name | Description |
---|---|---|
System.String | attribute | Name of the attribute. |
T | value | Out parameter through which the obtained item is returned. |
Returns
Type | Description |
---|---|
System.Boolean | True if the IJSONDocument contains the specified attribute; otherwise, false. |
Type Parameters
Name | Description |
---|---|
T | Specifies the type of attribute value to be obtained from IJSONDocument. |