Skip to content

Commit

Permalink
Merge pull request #486 from ably/add-gson-numbers-strategy-2
Browse files Browse the repository at this point in the history
fix: add numbers strategy for Gson to prevent changing int to double
  • Loading branch information
ttypic authored Oct 17, 2023
2 parents 8666957 + 60d198c commit b23c870
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.ToNumberPolicy;

import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -82,7 +83,11 @@ T decode(Map<String, Object> jsonMap) {
}

private Map<Byte, CodecPair> codecMap;
private static final Gson gson = new Gson();
private static final Gson gson = new Gson()
.newBuilder()
.setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE)
.create();

private final CipherParamsStorage cipherParamsStorage;


Expand Down

0 comments on commit b23c870

Please sign in to comment.