public JSONNode addArrayElement(Object value) {
    NodeType	type;

    if (getNodeType() != NodeType.ARRAY)
      return null;
    
    type = null;
    
    if (value != null) {
      if (value instanceof Boolean)
	type = NodeType.PRIMITIVE;
      else if (value instanceof Integer)
	type = NodeType.PRIMITIVE;
      else if (value instanceof Double)
	type = NodeType.PRIMITIVE;
      else if (value instanceof String)
	type = NodeType.PRIMITIVE;
      else if (value.getClass().isArray())
	type = NodeType.ARRAY;
      else
	type = NodeType.OBJECT;
    }
      
    return add(null, value, type);
  }