code: public static Object toArray( JSONArray jsonArray, Object root, JsonConfig jsonConfig ) {
        Class objectClass = root.getClass();
        if( jsonArray.size() == 0 ){
           return Array.newInstance( objectClass, 0 );
        }
  
        int[] dimensions = JSONArray.getDimensions( jsonArray );
        Object array = Array.newInstance( objectClass == null ? Object.class : objectClass,
              dimensions );
        int size = jsonArray.size();
        for( int i = 0; i < size; i++ ){
           Object value = jsonArray.get( i );
           if( JSONUtils.isNull( value ) ){
              Array.set( array, i, null );
           }else{
              Class type = value.getClass();
              if( JSONArray.class.isAssignableFrom( type ) ){
                 Array.set( array, i, toArray( (JSONArray) value, root, jsonConfig ) );
              }else if( String.class.isAssignableFrom( type )
                    || Boolean.class.isAssignableFrom( type ) || JSONUtils.isNumber( type )
                    || Character.class.isAssignableFrom( type )
                    || JSONFunction.class.isAssignableFrom( type ) ){
                 if( objectClass != null && !objectClass.isAssignableFrom( type ) ){
                    value = JSONUtils.getMorpherRegistry()
                          .morph( objectClass, value );
                 }
                 Array.set( array, i, value );
              }else{
                 try{
                    Object newRoot = jsonConfig.getNewBeanInstanceStrategy()
                          .newInstance( root.getClass(), null );
                    Array.set( array, i, JSONObject.toBean( (JSONObject) value, newRoot, jsonConfig ) );
                 }catch( JSONException jsone ){
                    throw jsone;
                 }catch( Exception e ){
                    throw new JSONException( e );
                 }
              }
           }
        }
        return array;
     }
docs: Creates a java array from a JSONArray.<br>