Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions formats/json/api/kotlinx-serialization-json.api
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ public final class kotlinx/serialization/json/JsonObjectBuilder {
public fun <init> ()V
public final fun build ()Lkotlinx/serialization/json/JsonObject;
public final fun put (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
public final fun remove (Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
}

public final class kotlinx/serialization/json/JsonObjectSerializer : kotlinx/serialization/KSerializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public class JsonObjectBuilder @PublishedApi internal constructor() {
*/
public fun put(key: String, element: JsonElement): JsonElement? = content.put(key, element)

/**
* Remove the JSON Element associated with the given [key].
*
* Returns the previous value associated with [key], or `null` if the key was not present.
*/
@ExperimentalSerializationApi
public fun remove(key: String): JsonElement? = content.remove(key)

@PublishedApi
internal fun build(): JsonObject = JsonObject(content)
}
Expand Down