code: public static BigDecimal toBigDecimal(JSONValue value) {
          JSONNumber number = value.isNumber();
          if (number != null) {
              return new BigDecimal(number.toString());
          }
  
          JSONString string = value.isString();
          if (string != null) {
              try {
                  return new BigDecimal(string.stringValue());
              } catch (NumberFormatException e) {
              }
          }
  
          throw new DecodingException("Expected a json number, but was given: " + value);
      }
docs: /////////////////////////////////////////////////////////////////