com.esri.arcgis.system
Interface IJSONObject

All Superinterfaces:
Serializable
All Known Implementing Classes:
JSONObject

public interface IJSONObject
extends Serializable

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

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Method Summary
 void add(String name, Object value)
          Adds new member name-value pair to the member collection.
 void addBoolean(String name, boolean value)
          Adds new member name-value pair to the member collection.
 void addDate(String name, Date value)
          Adds new member name-value pair to the member collection.
 void addDouble(String name, double value)
          Adds new member name-value pair to the member collection.
 void addDoubleEx(String name, double value, int precision)
          Adds new member name-value pair to the member collection.
 void addJSONArray(String name, IJSONArray value)
          Adds new member name-value pair to the member collection.
 void addJSONObject(String name, IJSONObject value)
          Adds new member name-value pair to the member collection.
 void addLong(String name, int value)
          Adds new member name-value pair to the member collection.
 void addNull(String name)
          Adds new member with the value of null to the member collection.
 void addString(String name, String value)
          Adds new member name-value pair to the member collection.
 void clearAll()
          Removes all members.
 void createMemberArray(String name, IJSONArray[] value)
          Creates and adds new member name-value pair to the member collection.
 void createMemberObject(String name, IJSONObject[] value)
          Creates and adds new member name-value pair to the member collection.
 void getMemberAt(int index, String[] name, Object[] value)
          Returns member name and value at a given index.
 int getMemberCount()
          Returns size of member collection.
 boolean isCaseSensitiveNames()
          Returns true if member name lookups are case-sensitive.
 boolean isValueNull(String name)
          Returns VARIANT_TRUE if member is undefined or member's value is null.
 void makeValueNull(String name)
          Make a designated member NULL.
 boolean memberExists(String name)
          Checks if a member with the given name exists.
 void parseJSON(IJSONReader pReader)
          Parses JSON object from IJSONReader into memory.
 void parseString(String json)
          Parses JSON object from string into memory.
 void removeMember(String name)
          Remove a member from the member collection.
 void setCaseSensitiveNames(boolean case_sensitive)
          Returns true if member name lookups are case-sensitive.
 void toJSON(String objectName, IJSONWriter pWriter)
          Converts IJSONObject to JSON representation using provided IJSONWriter.
 String toJSONString(IPropertySet props)
          Converts IJSONObject to JSON representation using IJSONWriter internally.
 boolean tryGetValue(String name, Object[] value)
          Returns member value for a given name.
 boolean tryGetValueAsArray(String name, IJSONArray[] value)
          Returns member value for a given name as IJSONArray.
 boolean tryGetValueAsBoolean(String name, boolean[] value)
          Returns member value for a given name as boolean.
 boolean tryGetValueAsDate(String name, Date[] value)
          Returns member value for a given name as DATE.
 boolean tryGetValueAsDouble(String name, double[] value)
          Returns member value for a given name as double.
 boolean tryGetValueAsLong(String name, int[] value)
          Returns member value for a given name as long.
 boolean tryGetValueAsObject(String name, IJSONObject[] value)
          Returns member value for a given name as IJSONObject.
 boolean tryGetValueAsString(String name, String[] value)
          Returns member value for a given name as string.
 

Method Detail

parseString

void parseString(String json)
                 throws IOException,
                        AutomationException
Parses JSON object from string into memory.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
json - The json (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

parseJSON

void parseJSON(IJSONReader pReader)
               throws IOException,
                      AutomationException
Parses JSON object from IJSONReader into memory. Useful if you want to have random acces to just a part of a JSON.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
pReader - A reference to a com.esri.arcgis.system.IJSONReader (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isCaseSensitiveNames

boolean isCaseSensitiveNames()
                             throws IOException,
                                    AutomationException
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.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Returns:
The case_sensitive
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCaseSensitiveNames

void setCaseSensitiveNames(boolean case_sensitive)
                           throws IOException,
                                  AutomationException
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.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
case_sensitive - The case_sensitive (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

memberExists

boolean memberExists(String name)
                     throws IOException,
                            AutomationException
Checks if a member with the given name exists.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
Returns:
The exists
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isValueNull

boolean isValueNull(String name)
                    throws IOException,
                           AutomationException
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.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
Returns:
The isNull
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMemberCount

int getMemberCount()
                   throws IOException,
                          AutomationException
Returns size of member collection.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMemberAt

void getMemberAt(int index,
                 String[] name,
                 Object[] value)
                 throws IOException,
                        AutomationException
Returns member name and value at a given index.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
index - The index (in)
name - The name (out: use single element array)
value - A Variant (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValue

boolean tryGetValue(String name,
                    Object[] value)
                    throws IOException,
                           AutomationException
Returns member value for a given name. If member does not exist, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A Variant (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValueAsDate

boolean tryGetValueAsDate(String name,
                          Date[] value)
                          throws IOException,
                                 AutomationException
Returns member value for a given name as DATE. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValueAsBoolean

boolean tryGetValueAsBoolean(String name,
                             boolean[] value)
                             throws IOException,
                                    AutomationException
Returns member value for a given name as boolean. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValueAsLong

boolean tryGetValueAsLong(String name,
                          int[] value)
                          throws IOException,
                                 AutomationException
Returns member value for a given name as long. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValueAsDouble

boolean tryGetValueAsDouble(String name,
                            double[] value)
                            throws IOException,
                                   AutomationException
Returns member value for a given name as double. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValueAsString

boolean tryGetValueAsString(String name,
                            String[] value)
                            throws IOException,
                                   AutomationException
Returns member value for a given name as string. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValueAsObject

boolean tryGetValueAsObject(String name,
                            IJSONObject[] value)
                            throws IOException,
                                   AutomationException
Returns member value for a given name as IJSONObject. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A reference to a com.esri.arcgis.system.IJSONObject (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

tryGetValueAsArray

boolean tryGetValueAsArray(String name,
                           IJSONArray[] value)
                           throws IOException,
                                  AutomationException
Returns member value for a given name as IJSONArray. If member does not exist or type coercion fails, returns VARIANT_FALSE in 'success' parameter.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A reference to a com.esri.arcgis.system.IJSONArray (out: use single element array)
Returns:
The success
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addDate

void addDate(String name,
             Date value)
             throws IOException,
                    AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addBoolean

void addBoolean(String name,
                boolean value)
                throws IOException,
                       AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addLong

void addLong(String name,
             int value)
             throws IOException,
                    AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addDouble

void addDouble(String name,
               double value)
               throws IOException,
                      AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addString

void addString(String name,
               String value)
               throws IOException,
                      AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addNull

void addNull(String name)
             throws IOException,
                    AutomationException
Adds new member with the value of null to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

add

void add(String name,
         Object value)
         throws IOException,
                AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addJSONObject

void addJSONObject(String name,
                   IJSONObject value)
                   throws IOException,
                          AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A reference to a com.esri.arcgis.system.IJSONObject (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addJSONArray

void addJSONArray(String name,
                  IJSONArray value)
                  throws IOException,
                         AutomationException
Adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A reference to a com.esri.arcgis.system.IJSONArray (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

createMemberObject

void createMemberObject(String name,
                        IJSONObject[] value)
                        throws IOException,
                               AutomationException
Creates and adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A reference to a com.esri.arcgis.system.IJSONObject (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

createMemberArray

void createMemberArray(String name,
                       IJSONArray[] value)
                       throws IOException,
                              AutomationException
Creates and adds new member name-value pair to the member collection. Returns E_FAIL if duplicate member is found.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - A reference to a com.esri.arcgis.system.IJSONArray (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

makeValueNull

void makeValueNull(String name)
                   throws IOException,
                          AutomationException
Make a designated member NULL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

toJSONString

String toJSONString(IPropertySet props)
                    throws IOException,
                           AutomationException
Converts IJSONObject to JSON representation using IJSONWriter internally. 'props' parameter is to control IJSONWriter properties. It's safe to set it to NULL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
props - A reference to a com.esri.arcgis.system.IPropertySet (in)
Returns:
The outStr
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

toJSON

void toJSON(String objectName,
            IJSONWriter pWriter)
            throws IOException,
                   AutomationException
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.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
objectName - The objectName (in)
pWriter - A reference to a com.esri.arcgis.system.IJSONWriter (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeMember

void removeMember(String name)
                  throws IOException,
                         AutomationException
Remove a member from the member collection.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

clearAll

void clearAll()
              throws IOException,
                     AutomationException
Removes all members.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addDoubleEx

void addDoubleEx(String name,
                 double value,
                 int precision)
                 throws IOException,
                        AutomationException
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.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
name - The name (in)
value - The value (in)
precision - The precision (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.