java.lang.Object
org.shredzone.acme4j.toolbox.JSONBuilder
Builder for JSON structures.
Example:
JSONBuilder cb = new JSONBuilder();
cb.put("foo", 123).put("bar", "hello world");
cb.object("sub").put("data", "subdata");
cb.array("array", 123, 456, 789);
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungarray(String key, Collection<?> values) Puts an array.Creates an object for the given key.Puts a property.Puts aDurationto the JSON.Puts anInstantto the JSON.Puts binary data to the JSON.Puts aKeyinto the claim.toJSON()Returns aJSONrepresentation of the current state.toMap()Returns aMaprepresentation of the current state.toString()Returns a JSON string representation of the current state.
-
Konstruktordetails
-
JSONBuilder
public JSONBuilder()
-
-
Methodendetails
-
put
Puts a property. If a property with the key exists, it will be replaced.- Parameter:
key- Property keyvalue- Property value- Gibt zurück:
this
-
put
Puts anInstantto the JSON. If a property with the key exists, it will be replaced.- Parameter:
key- Property keyvalue- PropertyInstantvalue- Gibt zurück:
this
-
put
Puts aDurationto the JSON. If a property with the key exists, it will be replaced.- Parameter:
key- Property keyvalue- PropertyDurationvalue- Gibt zurück:
this- Seit:
- 2.3
-
putBase64
Puts binary data to the JSON. The data is base64 url encoded.- Parameter:
key- Property keydata- Property data- Gibt zurück:
this
-
putKey
Puts aKeyinto the claim. The key is serializied as JWK.- Parameter:
key- Property keypublickey-PublicKeyto serialize- Gibt zurück:
this
-
object
Creates an object for the given key.- Parameter:
key- Key of the object- Gibt zurück:
- Newly created
JSONBuilderfor the object.
-
array
Puts an array.- Parameter:
key- Property keyvalues- Collection of property values- Gibt zurück:
this
-
toMap
Returns aMaprepresentation of the current state.- Gibt zurück:
Mapof the current state
-
toJSON
Returns aJSONrepresentation of the current state.- Gibt zurück:
JSONof the current state
-
toString
Returns a JSON string representation of the current state.
-