Skip to content

Commit

Permalink
Added check to see if it a string or int. (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Jan 2, 2018
1 parent 688afb2 commit 6225805
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/bunq/sdk/json/BigDecimalTypeAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ public void write(JsonWriter output, BigDecimal value) throws IOException {

@Override
public BigDecimal read(JsonReader input) throws IOException {
if (input.peek() == JsonToken.NUMBER) {
JsonToken type = input.peek();

if (type == JsonToken.NUMBER) {
return new BigDecimal(input.nextInt());
} else if (type == JsonToken.STRING) {
return new BigDecimal(input.nextString());
} else {
input.nextNull();
Expand Down

0 comments on commit 6225805

Please sign in to comment.