We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
Empty classes get a newline character added to the json object:
{ "some_empty_class": { } }
It's not very pretty 😅
To Reproduce
@Serializable data class Test( @SerialName("some_empty_class") val someEmptyClass: SomeEmptyClass, ) @Serializable class SomeEmptyClass println(Json{prettyPrint = true}.encodeToString(Test(SomeEmptyClass())))
Expected behavior All other libraries I have used when pretty printing would output:
{ "some_empty_class": {} }
Environment
The text was updated successfully, but these errors were encountered:
Well, it is a matter of preference, mostly :) But I agree that since most libraries fold empty objects, we should likely do the same.
Sorry, something went wrong.
Yeah for sure haha. I just haven't seen other libraries do it that way 👍
Make empty objects and arrays collapsed in pretty print mode
254dfcb
because it is a widespread convention. Fixes #2502
b994572
No branches or pull requests
Describe the bug
Empty classes get a newline character added to the json object:
It's not very pretty 😅
To Reproduce
Expected behavior
All other libraries I have used when pretty printing would output:
Environment
The text was updated successfully, but these errors were encountered: