public static long getParsedNumberAsLongOrThrow(JsonElement element) {
    Number num = element.getAsNumber();
    if (!(num instanceof LazilyParsedNumber)) {
      // We restrict this function to LazilyParsedNumber because then we know that "toString" will
      // return the unparsed number. For other implementations of Number interface, it is not
      // clearly defined what toString will return.
      throw new IllegalArgumentException("does not contain a parsed number.");
    }
    return Long.parseLong(element.getAsNumber().toString());
  }
Reads a {@link JsonElement} which cannot have any nested elements
java_src/src/main/java/com/google/crypto/tink/internal/JsonParser.java