IJSONObject Interface

Provides simplified DOM-like JSON serialization and de-serialization API.

Members

Name Description
Method Add Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddBoolean Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddDate Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddDouble Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddDoubleEx Adds new member name-value pair to the member collection. Stores precision for use in ToJSON and ToJSONString. Returns E_​FAIL if duplicate member is found.
Method AddJSONArray Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddJSONObject Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddLong Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddNull Adds new member with the value of null to the member collection. Returns E_​FAIL if duplicate member is found.
Method AddString Adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Read/write property CaseSensitiveNames Returns true if member name lookups are case-sensitive. Default value is true. Methods affected by this state change: MemberExists, IsValueNull and all TryGet... methods.
Method ClearAll Removes all members.
Method CreateMemberArray Creates and adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method CreateMemberObject Creates and adds new member name-value pair to the member collection. Returns E_​FAIL if duplicate member is found.
Method GetMemberAt Returns member name and value at a given index.
Method IsValueNull Returns VARIANT​TRUE if member is undefined or member's value is null. Returns VARIANT​FALSE if member exists and its value is not null.
Method MakeValueNull Make a designated member NULL.
Read-only property MemberCount Returns size of member collection.
Method MemberExists Checks if a member with the given name exists.
Method ParseJSON Parses JSON object from IJSONReader into memory. Useful if you want to have random access to just a part of a JSON.
Method ParseString Parses JSON object from string into memory.
Method RemoveMember Remove a member from the member collection.
Method ToJSON Converts IJSONObject to JSON representation using provided IJSONWriter. Useful when you have complex JSON response you want to combine from the output of several methods.
Method ToJSONString Converts IJSONObject to JSON representation using IJSONWriter internally. 'props' parameter is to control IJSONWriter properties. It's safe to set it to NULL.
Method TryGetValue Returns member value for a given name. If member does not exist, returns VARIANT_​FALSE in 'success' parameter.
Method TryGetValueAsArray Returns member value for a given name as IJSONArray. If member does not exist or type coercion fails, returns VARIANT_​FALSE in 'success' parameter.
Method TryGetValueAsBoolean Returns member value for a given name as boolean. If member does not exist or type coercion fails, returns VARIANT_​FALSE in 'success' parameter.
Method TryGetValueAsDate Returns member value for a given name as DATE. If member does not exist or type coercion fails, returns VARIANT_​FALSE in 'success' parameter.
Method TryGetValueAsDouble Returns member value for a given name as double. If member does not exist or type coercion fails, returns VARIANT_​FALSE in 'success' parameter.
Method TryGetValueAsLong Returns member value for a given name as long. If member does not exist or type coercion fails, returns VARIANT_​FALSE in 'success' parameter.
Method TryGetValueAsObject Returns member value for a given name as IJSONObject. If member does not exist or type coercion fails, returns VARIANT_​FALSE in 'success' parameter.
Method TryGetValueAsString Returns member value for a given name as string. If member does not exist or type coercion fails, returns VARIANT_​FALSE in 'success' parameter.

IJSONObject.Add Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub Add ( _
    ByVal Name As String, _
    ByVal Value As Object _
)
public void Add (
    string Name,
    object Value
);

IJSONObject.AddBoolean Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddBoolean ( _
    ByVal Name As String, _
    ByVal Value As Boolean _
)
public void AddBoolean (
    string Name,
    bool Value
);

IJSONObject.AddDate Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddDate ( _
    ByVal Name As String, _
    ByVal Value As DateTime _
)
public void AddDate (
    string Name,
    DateTime Value
);

IJSONObject.AddDouble Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddDouble ( _
    ByVal Name As String, _
    ByVal Value As Double _
)
public void AddDouble (
    string Name,
    double Value
);

IJSONObject.AddDoubleEx Method

Adds new member name-value pair to the member collection. Stores precision for use in ToJSON and ToJSONString. Returns E_FAIL if duplicate member is found.

Public Sub AddDoubleEx ( _
    ByVal Name As String, _
    ByVal Value As Double, _
    ByVal precision As Integer _
)
public void AddDoubleEx (
    string Name,
    double Value,
    int precision
);

IJSONObject.AddJSONArray Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddJSONArray ( _
    ByVal Name As String, _
    ByVal Value As IJSONArray _
)
public void AddJSONArray (
    string Name,
    IJSONArray Value
);

IJSONObject.AddJSONObject Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddJSONObject ( _
    ByVal Name As String, _
    ByVal Value As IJSONObject _
)
public void AddJSONObject (
    string Name,
    IJSONObject Value
);

IJSONObject.AddLong Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddLong ( _
    ByVal Name As String, _
    ByVal Value As Integer _
)
public void AddLong (
    string Name,
    int Value
);

IJSONObject.AddNull Method

Adds new member with the value of null to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddNull ( _
    ByVal Name As String _
)
public void AddNull (
    string Name
);

IJSONObject.AddString Method

Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub AddString ( _
    ByVal Name As String, _
    ByVal Value As String _
)
public void AddString (
    string Name,
    string Value
);

IJSONObject.CaseSensitiveNames Property

Returns true if member name lookups are case-sensitive. Default value is true. Methods affected by this state change: MemberExists, IsValueNull and all TryGet... methods.

Public Property CaseSensitiveNames As Boolean
public bool CaseSensitiveNames {get; set;}

IJSONObject.ClearAll Method

Removes all members.

Public Sub ClearAll ( _
)
public void ClearAll (
);

IJSONObject.CreateMemberArray Method

Creates and adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub CreateMemberArray ( _
    ByVal Name As String, _
    ByRef Value As IJSONArray _
)
public void CreateMemberArray (
    string Name,
    ref IJSONArray Value
);

IJSONObject.CreateMemberObject Method

Creates and adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Public Sub CreateMemberObject ( _
    ByVal Name As String, _
    ByRef Value As IJSONObject _
)
public void CreateMemberObject (
    string Name,
    ref IJSONObject Value
);

IJSONObject.GetMemberAt Method

Returns member name and value at a given index.

Public Sub GetMemberAt ( _
    ByVal Index As Integer, _
    ByRef Name As String, _
    ByRef Value As Object _
)
public void GetMemberAt (
    int Index,
    ref string Name,
    ref object Value
);

IJSONObject.IsValueNull Method

Returns VARIANT_TRUE if member is undefined or member's value is null. Returns VARIANT_FALSE if member exists and its value is not null.

Public Function IsValueNull ( _
    ByVal Name As String _
) As Boolean
public bool IsValueNull (
    string Name
);

IJSONObject.MakeValueNull Method

Make a designated member NULL.

Public Sub MakeValueNull ( _
    ByVal Name As String _
)
public void MakeValueNull (
    string Name
);

IJSONObject.MemberCount Property

Returns size of member collection.

Public ReadOnly Property MemberCount As Integer
public int MemberCount {get;}

IJSONObject.MemberExists Method

Checks if a member with the given name exists.

Public Function MemberExists ( _
    ByVal Name As String _
) As Boolean
public bool MemberExists (
    string Name
);

IJSONObject.ParseJSON Method

Parses JSON object from IJSONReader into memory. Useful if you want to have random access to just a part of a JSON.

Public Sub ParseJSON ( _
    ByVal pReader As IJSONReader _
)
public void ParseJSON (
    IJSONReader pReader
);

IJSONObject.ParseString Method

Parses JSON object from string into memory.

Public Sub ParseString ( _
    ByVal json As String _
)
public void ParseString (
    string json
);

IJSONObject.RemoveMember Method

Remove a member from the member collection.

Public Sub RemoveMember ( _
    ByVal Name As String _
)
public void RemoveMember (
    string Name
);

IJSONObject.ToJSON Method

Converts IJSONObject to JSON representation using provided IJSONWriter. Useful when you have complex JSON response you want to combine from the output of several methods.

Public Sub ToJSON ( _
    ByVal objectName As String, _
    ByVal pWriter As IJSONWriter _
)
public void ToJSON (
    string objectName,
    IJSONWriter pWriter
);

IJSONObject.ToJSONString Method

Converts IJSONObject to JSON representation using IJSONWriter internally. 'props' parameter is to control IJSONWriter properties. It's safe to set it to NULL.

Public Function ToJSONString ( _
    ByVal props As IPropertySet _
) As String
public string ToJSONString (
    IPropertySet props
);

IJSONObject.TryGetValue Method

Returns member value for a given name. If member does not exist, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValue ( _
    ByVal Name As String, _
    ByRef Value As Object _
) As Boolean
public bool TryGetValue (
    string Name,
    ref object Value
);

IJSONObject.TryGetValueAsArray Method

Returns member value for a given name as IJSONArray. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValueAsArray ( _
    ByVal Name As String, _
    ByRef Value As IJSONArray _
) As Boolean
public bool TryGetValueAsArray (
    string Name,
    ref IJSONArray Value
);

IJSONObject.TryGetValueAsBoolean Method

Returns member value for a given name as boolean. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValueAsBoolean ( _
    ByVal Name As String, _
    ByRef Value As Boolean _
) As Boolean
public bool TryGetValueAsBoolean (
    string Name,
    ref bool Value
);

IJSONObject.TryGetValueAsDate Method

Returns member value for a given name as DATE. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValueAsDate ( _
    ByVal Name As String, _
    ByRef Value As DateTime& _
) As Boolean
public bool TryGetValueAsDate (
    string Name,
    ref DateTime& Value
);

IJSONObject.TryGetValueAsDouble Method

Returns member value for a given name as double. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValueAsDouble ( _
    ByVal Name As String, _
    ByRef Value As Double _
) As Boolean
public bool TryGetValueAsDouble (
    string Name,
    ref double Value
);

IJSONObject.TryGetValueAsLong Method

Returns member value for a given name as long. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValueAsLong ( _
    ByVal Name As String, _
    ByRef Value As Integer _
) As Boolean
public bool TryGetValueAsLong (
    string Name,
    ref int Value
);

IJSONObject.TryGetValueAsObject Method

Returns member value for a given name as IJSONObject. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValueAsObject ( _
    ByVal Name As String, _
    ByRef Value As IJSONObject _
) As Boolean
public bool TryGetValueAsObject (
    string Name,
    ref IJSONObject Value
);

IJSONObject.TryGetValueAsString Method

Returns member value for a given name as string. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Public Function TryGetValueAsString ( _
    ByVal Name As String, _
    ByRef Value As String _
) As Boolean
public bool TryGetValueAsString (
    string Name,
    ref string Value
);

Classes that implement IJSONObject

Classes Description
JSONObject Simplified JSON API coclass

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.