public JSONArray asJSONArray()
	throws JSONException {

	//throw new JSONException( "Cannot convert this value (" + this.getTypeName() + ") to a JSON array (incompatible types)." );
	
	// As it is possible to convert an array into an object (indices become member names)
	// it should be possible to re-convert such an object.
	// This requires the member names to address array indices in a half closed interval [0, n).
	
	// Prepare the list with the exact capacity
	int size = this.getMap().size();
	Map<Integer,JSONValue> indexMap = new TreeMap<Integer,JSONValue>();
	
	// Iterate through all elements
	Iterator<Map.Entry<String,JSONValue>> iter = this.getMap().entrySet().iterator();
	while( iter.hasNext() ) {

	    // The tuple (memberName, memberValue)
	    Map.Entry<String,JSONValue> entry = iter.next();
	    String memberName = entry.getKey();
	    if( memberName == null ) // This should not happen!
		super.asJSONArray(); // this call will raise the default exception
	    
	    try {	
		
		int index = Integer.parseInt( memberName );

		// Check bounds
		if( index < 0 || index >= size )
		    super.asJSONArray();

		// Check if array index is already in use.
		if( indexMap.get(new Integer(index)) != null )
		    super.asJSONArray();
		
		// Seems OK.
		indexMap.put( new Integer(index), 
			      entry.getValue() 
			      );
		
	    } catch( NumberFormatException e ) {
		
		// The element name is not a number.
		// This call will throw the default exception.
		super.asJSONArray();
	    }

	}
	


	// The member name set is valid.
	// Now convert the index map to an array/list
	List<JSONValue> list = new ArrayList<JSONValue>( Math.max(size,1) );
	Iterator<Integer> indexIter = indexMap.keySet().iterator(); // This is a SORTED SET :)
	while( indexIter.hasNext() ) {

	    Integer index   = indexIter.next();
	    JSONValue value = indexMap.get( index );
	    
	    list.add( value );
	    
	}

	return new JSONArray( list );
    }