public static String toJson(final Object object){
  return toJson(object,true);
}

public static String toJson ( final Object object ) { return toJson ( object , true ) ; }
recursively convert from native rhino to json . < p > recognizes javascript objects , arrays and primitives . < p > special support for javascript dates : converts to { " $ date " : timestamp } in json . < p > special support for mongodb objectid : converts to { " $ oid " : " objectid " } in json . < p > also recognizes jvm types : java . util . map , java . util . collection , java . util . date .
