api / tv.twelvetone.json / JsonObject / add

add

fun add(name: String, value: Int): JsonObject

Appends a new member to the end of this object, with the specified name and the JSON representation of the specified int value.

This method does not prevent duplicate names. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method set(name, value) instead. However, ** add is much faster than set** (because it does not need to search for existing members). Therefore add should be preferred when constructing new objects.

Parameters

name - the name of the member to add value - the value of the member to add

Return
the object itself, to enable method chaining

fun add(name: String, value: Long): JsonObject

Appends a new member to the end of this object, with the specified name and the JSON representation of the specified long value.

This method does not prevent duplicate names. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method set(name, value) instead. However, ** add is much faster than set** (because it does not need to search for existing members). Therefore add should be preferred when constructing new objects.

Parameters

name - the name of the member to add value - the value of the member to add

Return
the object itself, to enable method chaining

fun add(name: String, value: Float): JsonObject

Appends a new member to the end of this object, with the specified name and the JSON representation of the specified float value.

This method does not prevent duplicate names. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method set(name, value) instead. However, ** add is much faster than set** (because it does not need to search for existing members). Therefore add should be preferred when constructing new objects.

Parameters

name - the name of the member to add value - the value of the member to add

Return
the object itself, to enable method chaining

fun add(name: String, value: Double): JsonObject

Appends a new member to the end of this object, with the specified name and the JSON representation of the specified double value.

This method does not prevent duplicate names. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method set(name, value) instead. However, ** add is much faster than set** (because it does not need to search for existing members). Therefore add should be preferred when constructing new objects.

Parameters

name - the name of the member to add value - the value of the member to add

Return
the object itself, to enable method chaining

fun add(name: String, value: Boolean): JsonObject

Appends a new member to the end of this object, with the specified name and the JSON representation of the specified boolean value.

This method does not prevent duplicate names. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method set(name, value) instead. However, ** add is much faster than set** (because it does not need to search for existing members). Therefore add should be preferred when constructing new objects.

Parameters

name - the name of the member to add value - the value of the member to add

Return
the object itself, to enable method chaining

fun add(name: String, value: String): JsonObject

Appends a new member to the end of this object, with the specified name and the JSON representation of the specified string.

This method does not prevent duplicate names. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method set(name, value) instead. However, ** add is much faster than set** (because it does not need to search for existing members). Therefore add should be preferred when constructing new objects.

Parameters

name - the name of the member to add value - the value of the member to add

Return
the object itself, to enable method chaining

fun add(name: String?, value: JsonValue?): JsonObject

Appends a new member to the end of this object, with the specified name and the specified JSON value.

This method does not prevent duplicate names. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method set(name, value) instead. However, ** add is much faster than set** (because it does not need to search for existing members). Therefore add should be preferred when constructing new objects.

Parameters

name - the name of the member to add value - the value of the member to add, must not be null

Return
the object itself, to enable method chaining