[JSON] Pluggable JSON parsing to remove GSON dependency
See original GitHub issueI am interested in creating a pluggable JSON parsing system to allow for replacing GSON with another parser, such as Moshi that is popular for Android apps to help reduce the app size footprint of the sentry Android library. From my testing sentry-android
ends up adding ~1.5MB to the app size, but sentry-android-core
without the NDK bundle only adds about 200-400KB to the download size where a significant percent of that is the GSON library.
Is there any appetite for a contribution that would refactor to allow a different json parser for Android such as Moshi? This would be a pretty large change, so I want to have a discussion before I begin.
Some changes (but probably not all) that I see this involving:
- refactoring gson code into its own module.
- creating a
sentry-android-moshi-extension
module or similar to encapsulate the moshi, or other parsing code. One particular point about moshi is that it is in kotlin so non test code would be in kotlin, in this module. - Create a system so the default sentry package was GSON as it is today and an extension package could be added for moshi or other parsers that would exclude gson.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Remove dependency on GSON internal API #304 - GitHub
JSON class depends on ISO8601Utils from GSON internal API. The utils class is sued to parse sql dates from string and render to...
Read more >How to parse JSON in Java - Stack Overflow
java's built in JSON libraries are the quickets way to do so, but in my experience GSON is the best library for parsing...
Read more >Gson - How to parse JSON - Mkyong.com
import java.lang.reflect.Modifier; Gson gson = new GsonBuilder() .excludeFieldsWithModifiers(Modifier.STATIC) .
Read more >Gson User Guide - Google Sites
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to...
Read more >Parsing JSON using GSON within a Maven project in IntelliJ ...
... soup: I show how to create a Maven project within IntelliJ IDEA, bring in the GSON library, and use that to parse...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah. That would solve the issue for us completely since no large external libraries would be used that have duplicate functionality
Got it. Thank you for the context @marandaneto and @bruno-garcia