https://kotlinlang.org logo
#serialization
Title
# serialization
j

Joshua Hansen

11/13/2023, 11:00 PM
Hi. I'm trying to serialize some data to JSON, and although I know this is a nitpick and not required by any means, I was wondering if it's possible to override the default implementation of serializing a MutableList so that an empty list doesn't encode with a newline character between brackets? I'm just shooting for consistency in output format, as the other source that this data can be obtained from serializes empty lists in this way. Default output is this:
Copy code
"theEmptyList": [
],
And I'd like this:
Copy code
"theEmptyList": [],
plus1 4