code: public static void writeJSONString(Collection collection, Writer out) throws IOException{
  		if(collection == null){
  			out.write("null");
  			return;
  		}
  		
  		boolean first = true;
  		Iterator iter=collection.iterator();
  		
          out.write('[');
  		while(iter.hasNext()){
              if(first)
                  first = false;
              else
                  out.write(',');
              
  			Object value=iter.next();
  			if(value == null){
  				out.write("null");
  				continue;
  			}
  			
  			JSONValue.writeJSONString(value, out);
  		}
  		out.write(']');
  	}
docs: Encode a list into JSON text and write it to out.
  If this list is also a JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific behaviours will be ignored at this top level.
  
  @see org.json.simple.JSONValue#writeJSONString(Object, java.io.Writer)
  
  @param collection
  @param out