Skip to content
New issue

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

Support JsonTreeWriter #25

Merged
merged 2 commits into from
Nov 18, 2020
Merged

Support JsonTreeWriter #25

merged 2 commits into from
Nov 18, 2020

Conversation

ZacSweers
Copy link
Collaborator

Uses internal APIs but this library isn't stable anyway. This works around that issue until a fixed future version of GSON that properly supports jsonValue in JsonTreeWriter (if ever) by converting it manually to a JsonElement and writing it directly via its JsonElement TypeAdapter.

Resolves #22

Uses internal APIs but this library isn't stable anyway. This works around that issue until a fixed future version of GSON that properly supports jsonValue in JsonTreeWriter (if ever) by converting it manually to a `JsonElement` and writing it directly via its `JsonElement` `TypeAdapter`.

Resolves #22
}
is Collection<*> -> {
JsonArray(size).apply {
for (element in this@toJsonElement) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tricky

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I scratched my head at this for longer than I'm willing to admit

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay for tests

@ZacSweers ZacSweers merged commit fc4b0ce into main Nov 18, 2020
@ZacSweers ZacSweers deleted the z/workWithJsonTreeWriter branch November 18, 2020 02:53
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.

Incompatible with JsonTreeWriter
2 participants