Skip to content

Conversation

prayansh
Copy link
Contributor

@prayansh prayansh commented Aug 19, 2021

In our efforts to provide convenience APIs, we have added a new function JsonObject.mapTransform(Map<String, String>,((String, JsonElement) -> JsonElement)?) that allows you to easily map keys and transform values based on a closure. Example usage:

 properties.mapTransform(mapOf("x" to "y")) { newKey, value ->
    var newVal = value
    if (newKey == "y") {
        // ... do something
    }
    newVal
}

@prayansh prayansh requested review from wenxi-zeng and migs647 August 20, 2021 00:11
@prayansh prayansh merged commit 6514588 into main Aug 20, 2021
@prayansh prayansh deleted the pray/mapKeys branch August 20, 2021 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants