Convert any Java Object to JavaScript representation, converting types properly, e.g.:
Java primitives
Arrays: toScript(new int[] { 1, 2, 3 }) -> [1, 2, 3]
Collections (sets, lists): toScript(Arrays.asList(new int[] { 1, 2, 3 })) -> [1, 2, 3]
Maps: toScript((Map<String, String>)map) -> {\"a\":\"foo\",\"b\":\"bar\",\"c\":\"baz\"}
Beans / Objects: toScript(new Bean[] { new Bean(1, true, "bar") }) -> [{\"bool\":true,\"foo\":\"bar\",\"integer\":1}]
Dates and Timezones
Combinations of above
This function delegates to org.ajax4jsf.javascript.ScriptUtils#toScript(Object)