# rich

## Function toScript

- Signature:
    `java.lang.String toScript(java.lang.Object)`
  Description:
    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.richfaces.javascript.ScriptUtils#toScript(Object)

- Function Information
  Info | Value
  --- | ---
  Function Class | `org.richfaces.function.RichFunction`
  Function Signature | `java.lang.String toScript(java.lang.Object)`
  Display Name | None

Output generated by Vdldoc View Declaration Language Documentation Generator.