|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.omnifaces.util.Json
public final class Json
A simple JSON encoder.
Method Summary | |
---|---|
static java.lang.String |
encode(java.lang.Object object)
Encodes the given object as JSON. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String encode(java.lang.Object object)
Boolean
, Number
,
CharSequence
and Date
. If the given object type does not match any of them, then it will attempt
to inspect the object as a javabean whereby the public properties (with public getters) will be encoded as a JS
object. It also supports Collection
s, Map
s and arrays of them, even nested ones. The Date
is formatted in RFC 1123 format, so you can if necessary just pass it straight to new Date()
in
JavaScript.
object
- The object to be encoded as JSON.
java.lang.IllegalArgumentException
- When the given object or one of its properties cannot be inspected as a bean.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |