optimizely / optimizely/java-sdk
[BUG] Gson deserialization treats integers as doubles, breaking downstream serializers
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 44
- Forks
- 32
- Avg merge
- 8h 39m
- Merged PRs (30d)
- 1
Description
Is there an existing issue for this?
- I have searched the existing issues
SDK Version
4.4.0
Current Behavior
When using JSON variables with GsonConfigParser, integers within JSON variables appear as doubles to outside consumers. The Map output then can't be returned to valid JSON for use with downstream JSON parsing tools, like kotlinx.serialization.
Expected Behavior
Integer-looking JSON values are deserialized to longs, while decimal-looking JSON values are deserialized to doubles.
Steps To Reproduce
See associated pull request.
Java Version
21
Link
No response
Logs
No response
Severity
Minor issue
Workaround/Solution
Re-interpret doubles as integers where needed.
Recent Change
No response
Conflicts
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the GsonConfigParser entry point in SDK version 4.4.0 and reproduce the JSON-variable behavior described in the issue using Java 21. Compare integer-looking and decimal-looking values in the resulting Map; done means integers are represented as longs and decimals as doubles without breaking downstream JSON serialization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100