Class Json

java.lang.Object
com.sun.faces.util.Json

public class Json extends Object

Generic JSON encoder using jakarta.json API.

This supports the standard types Boolean, Number, Character, CharSequence, Date, LocalDate and Instant. If the given object type does not match any of them, then it will attempt to inspect the object as a JavaBean using the Introspector, whereby the public properties (public getters) will be encoded as a JS object. It also supports arrays, Collections and Maps of them, even nested ones. The dates are formatted as ISO8601 instant via DateTimeFormatter.ISO_INSTANT, so you can if necessary just pass the value straight to new Date(value) in JavaScript.

Below encoding options are available:

Since:
2.3