public final class Json extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static String | encode(Object object)Encodes the given object as JSON. | 
| static String | encode(Object object,
      UnaryOperator<String> propertyNameFormatter)Does the same as  encode(Object)but then with a custom property name formatter. | 
public static String encode(Object object)
Boolean, Number,
 CharSequence, Date and since OmniFaces 3.6 also Enum and Temporal. 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 Collections,
 Maps and arrays of them, even nested ones. The Date and Temporal are 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.IllegalArgumentException - When the given object or one of its properties cannot be inspected as a bean.public static String encode(Object object, UnaryOperator<String> propertyNameFormatter)
encode(Object) but then with a custom property name formatter.object - The object to be encoded as JSON.propertyNameFormatter - The property name formatter. When this is null, then the property names are not
 adjusted.IllegalArgumentException - When the given object or one of its properties cannot be inspected as a bean.Copyright © 2012–2020 OmniFaces. All rights reserved.