JsonArrayBuilder
- add convenience function for adding multiple elements
#2127
Labels
JsonArrayBuilder
- add convenience function for adding multiple elements
#2127
What is your use-case and why do you need this feature?
When building a JSON array I'd like to add multiple strings.
Currently this must be done one at a time, using
JsonArrayBuilder.add(value: String?)
It's a surprise that
buildJsonArray()
doesn't haveaddAll()
, becausebuildList()
does haveaddAll()
.Describe the solution you'd like
It would be convenient to have an
addAll(elements: Collection<String>)
helper function that would accept a listI'm proposing four new functions.
1 function in
JsonArrayBuilder
for adding multipleJsonElement
s.And 3 extension functions, for adding strings, numbers, booleans:
Example usage
The text was updated successfully, but these errors were encountered: