Code example for JsonReader

Methods: nextNullpeek

0
 */ 
public final class BigDecimalTypeAdapter extends TypeAdapter<BigDecimal> {
 
  @Override 
  public BigDecimal read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
      in.nextNull();
      return null; 
    } 
    try { 
      return new BigDecimal(in.nextString());
    } catch (NumberFormatException e) {
      throw new JsonSyntaxException(e);
    } 
  } 
 
  @Override 
  public void write(JsonWriter out, BigDecimal value) throws IOException {
    out.value(value);
  } 
Connect your IDE to all the code out there  Get Codota for Java