private void writeObject(String name, Object obj, StringBuffer sb, String prepend) {
		if( name != null) {
			sb.append(prepend+_json_quote+name+_json_quote+":");
		}
		if(obj instanceof JSONObject) {
			JSONObject o = (JSONObject)obj;
			o.pre_serialize();
			if( name == null) {
				sb.append(prepend);
			}
			sb.append("{\n");
			o.serialize(sb,prepend+_json_tab);
			sb.append(prepend+"},\n");
		} else {
		if(obj instanceof Collection) {
			Collection<Object> v = (Collection<Object>)obj;
			sb.append("[\n");
			for( Object o : v) {
				writeObject(null,o,sb,prepend+_json_tab);
			}
			sb.append(prepend+"],\n");	
		} else
		if(obj instanceof String) {
			String o = (String)obj;
			sb.append(_json_quote+o+_json_quote+",\n");
		} else
		if(obj instanceof Integer) {
			Integer o = (Integer)obj;
			sb.append(o.intValue()+",\n");
		} else
		if(obj instanceof Float) {
			Float o = (Float)obj;
			sb.append(o.doubleValue()+",\n");
		} else
			sb.append(obj+",\n");
		}
		
	}