com-lihaoyi / upickle

uPickle: a simple, fast, dependency-free JSON & Binary (MessagePack) serialization library for Scala
https://com-lihaoyi.github.io/upickle
MIT License
706 stars 158 forks source link

Compactly render empty arrays and dictionaries even when indentation is specified #499

Closed lihaoyi closed 12 months ago

lihaoyi commented 1 year ago

Currently, these are spread over 3 lines:

@ upickle.default.write(Map[Int, Int](), indent = 4)
res2: String = """{

}"""

@ upickle.default.write(Array[Int](), indent = 4)
res3: String = """[

]"""

Ideally we should be able to render them in one line, as {}, and [], without the extraneous newlines