public JSONObject( JSONObject.Type t ) {
			type = t;
			switch ( t ) {
				case Type.ARRAY:
					list = new ArrayList();
					break;
				case Type.OBJECT:
					list = new ArrayList();
					keys = new ArrayList();
					break;
			}
		}
		static void MergeRecur( JSONObject left, JSONObject right ) {
			if ( right.type == JSONObject.Type.OBJECT ) {
				for ( int i = 0; i < right.list.Count; i++ ) {
					if ( right.keys [ i ] != null ) {
						string key = (string) right.keys [ i ];
						JSONObject val = (JSONObject) right.list [ i ];
						if ( val.type == JSONObject.Type.ARRAY || val.type == JSONObject.Type.OBJECT ) {
							if ( left.HasField( key ) )
								MergeRecur( left [ key ], val );
							else
								left.AddField( key, val );
						} else {
							if ( left.HasField( key ) )
								left.SetField( key, val );
							else
								left.AddField( key, val );
						}
					}
				}
			}// else left.list.Add(right.list);
		}
		/*
		 * The Merge function is experimental. Use at your own risk.
		 */
		public void Merge( JSONObject obj ) {
			MergeRecur( this, obj );
		}
		public void SetField( string name, JSONObject obj ) {
			if ( HasField( name ) ) {
				list.Remove( this [ name ] );
				keys.Remove( name );
			}
			AddField( name, obj );
		}
		public void AddField( string name, JSONObject obj ) {
			if ( obj ) {        //Don't do anything if the object is null
				if ( type != JSONObject.Type.OBJECT ) {
					type = JSONObject.Type.OBJECT;      //Congratulations, son, you're an OBJECT now
					Debug.LogWarning( "tried to add a field to a non-object JSONObject.  We'll do it for you, but you might be doing something wrong." );
				}
				keys.Add( name );
				list.Add( obj );
			}
		}
		public void Add( JSONObject obj ) {
			if ( obj ) {        //Don't do anything if the object is null
				if ( type != JSONObject.Type.ARRAY ) {
					type = JSONObject.Type.ARRAY;       //Congratulations, son, you're an ARRAY now
					Debug.LogWarning( "tried to add an object to a non-array JSONObject.  We'll do it for you, but you might be doing something wrong." );
				}
				list.Add( obj );
			}
		}