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 aDuration
to the JSON.Puts anInstant
to the JSON.Puts binary data to the JSON.Puts aKey
into the claim.toJSON()
Returns aJSON
representation of the current state.toMap()
Returns aMap
representation 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 anInstant
to the JSON. If a property with the key exists, it will be replaced.- Parameter:
key
- Property keyvalue
- PropertyInstant
value- Gibt zurück:
this
-
put
Puts aDuration
to the JSON. If a property with the key exists, it will be replaced.- Parameter:
key
- Property keyvalue
- PropertyDuration
value- 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 aKey
into the claim. The key is serializied as JWK.- Parameter:
key
- Property keypublickey
-PublicKey
to serialize- Gibt zurück:
this
-
object
Creates an object for the given key.- Parameter:
key
- Key of the object- Gibt zurück:
- Newly created
JSONBuilder
for the object.
-
array
Puts an array.- Parameter:
key
- Property keyvalues
- Collection of property values- Gibt zurück:
this
-
toMap
Returns aMap
representation of the current state.- Gibt zurück:
Map
of the current state
-
toJSON
Returns aJSON
representation of the current state.- Gibt zurück:
JSON
of the current state
-
toString
Returns a JSON string representation of the current state.
-