public static String toJSONString(List list){
  if (list == null)   return "null";
  boolean first=true;
  StringBuffer sb=new StringBuffer();
  Iterator iter=list.iterator();
  sb.append('[');
  while (iter.hasNext()) {
    if (first)     first=false;
 else     sb.append(',');
    Object value=iter.next();
    if (value == null) {
      sb.append("null");
      continue;
    }
    sb.append(JSONValue.toJSONString(value));
  }
  sb.append(']');
  return sb.toString();
}

public static String toJSONString ( List list ) { if ( list == null ) return "null" ; boolean first = true ; StringBuffer sb = new StringBuffer ( ) ; Iterator iter = list . iterator ( ) ; sb . append ( '[' ) ; while ( iter . hasNext ( ) ) { if ( first ) first = false ; else sb . append ( ',' ) ; Object value = iter . next ( ) ; if ( value == null ) { sb . append ( "null" ) ; continue ; } sb . append ( JSONValue . toJSONString ( value ) ) ; } sb . append ( ']' ) ; return sb . toString ( ) ; }
convert a list to json text . the result is a json array . if this list is also a jsonaware , jsonaware specific behaviours will be omitted at this top level .
