question: public static String toJson ( final Object object , final boolean indent ) { final StringBuilder s = new StringBuilder ( ) ; encode ( s , object , indent , indent ? 0 : - 1 ) ; return s . toString ( ) ; }
target:  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.