api / tv.twelvetone.json / JsonObject / set

set

operator fun set(name: String, value: Int): JsonObject

Sets the value of the member with the specified name to the JSON representation of the specified int value. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).

Parameters

name - the name of the member to replace value - the value to set to the member

Return
the object itself, to enable method chaining

operator fun set(name: String, value: Long): JsonObject

Sets the value of the member with the specified name to the JSON representation of the specified long value. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).

Parameters

name - the name of the member to replace value - the value to set to the member

Return
the object itself, to enable method chaining

operator fun set(name: String, value: Float): JsonObject

Sets the value of the member with the specified name to the JSON representation of the specified float value. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).

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

operator fun set(name: String, value: Double): JsonObject

Sets the value of the member with the specified name to the JSON representation of the specified double value. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).

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

operator fun set(name: String, value: Boolean): JsonObject

Sets the value of the member with the specified name to the JSON representation of the specified boolean value. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).

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

operator fun set(name: String, value: String): JsonObject

Sets the value of the member with the specified name to the JSON representation of the specified string. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).

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

operator fun set(name: String?, value: JsonValue?): JsonObject

Sets the value of the member with the specified name to the specified JSON value. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).

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