Class JsonObject
Inheritance
System.Object
JsonObject
Implements
System.ICloneable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Subsembly.Json.dll
Syntax
public class JsonObject : JsonValue, ICloneable
Constructors
JsonObject()
Declaration
JsonObject(IDictionary<String, JsonValue>)
Declaration
public JsonObject(IDictionary<string, JsonValue> aValue)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IDictionary<System.String, JsonValue> |
aValue |
|
Methods
GetBool(String)
Declaration
public bool GetBool(string sName)
Parameters
Type |
Name |
Description |
System.String |
sName |
|
Returns
Type |
Description |
System.Boolean |
|
Exceptions
Type |
Condition |
System.ArgumentNullException |
The parameter sName was null .
|
GetDateIfNotEmpty(String)
Declaration
public DateTime GetDateIfNotEmpty(string sName)
Parameters
Type |
Name |
Description |
System.String |
sName |
|
Returns
Type |
Description |
System.DateTime |
If the property does not exist, or if the property contains a
Null or an Undefined value,
then DateTime.MinValue is returned. If the property contains a
Number, then it is interpreted as a tick value.
Otherwise an attempt is made to parse it as an ISO date string.
|
Exceptions
Type |
Condition |
System.ArgumentNullException |
The parameter sName was null .
|
JsonTypeException |
The property did contain a JSON value that cannot be meaningfully converted
to a DateTime . For example Boolean,
Object, or Array.
|
GetIfNotEmpty(String)
Convenience for conditionally getting a string property.
Declaration
public string GetIfNotEmpty(string sName)
Parameters
Type |
Name |
Description |
System.String |
sName |
Name of property to get. Must not be null .
|
Returns
Type |
Description |
System.String |
If the named property exists, then its string value will be returned. If the
property does not exist, or if the property contains a Null
or an Undefined value, then null is returned.
|
Exceptions
Type |
Condition |
System.ArgumentNullException |
The parameter sName was null .
|
GetIfNotNaN<T>(String, T)
Declaration
public T GetIfNotNaN<T>(string sName, T nDefaultValue = null)
Parameters
Type |
Name |
Description |
System.String |
sName |
|
T |
nDefaultValue |
|
Returns
Type Parameters
Exceptions
Type |
Condition |
System.ArgumentNullException |
The parameter sName was null .
|
GetOwnPropertyNames()
Declaration
public ICollection<string> GetOwnPropertyNames()
Returns
Type |
Description |
System.Collections.Generic.ICollection<System.String> |
|
HasOwnProperty(String)
Declaration
public bool HasOwnProperty(string sName)
Parameters
Type |
Name |
Description |
System.String |
sName |
|
Returns
Type |
Description |
System.Boolean |
|
Parse(Byte[])
Declaration
public static JsonObject Parse(byte[] vbJson)
Parameters
Type |
Name |
Description |
System.Byte[] |
vbJson |
|
Returns
Parse(String)
Declaration
public static JsonObject Parse(string sJson)
Parameters
Type |
Name |
Description |
System.String |
sJson |
|
Returns
SetIfNotEmpty(String, JsonValue)
Convenience for conditionally setting an object property.
Declaration
public void SetIfNotEmpty(string sName, JsonValue aValue)
Parameters
Type |
Name |
Description |
System.String |
sName |
Name of property to set. Must not be null .
|
JsonValue |
aValue |
Value to set for the named property. If this is null or an instance of
type Null, or an instance of type
Undefined, or a null or empty
String, then the property will not be set.
|
Exceptions
Type |
Condition |
System.ArgumentNullException |
The parameter sName was null .
|
Implements
System.ICloneable