When using a JSON object with a large integer value, the application throws an error indicating that the integer is too large for an Int64
. How can I modify the code to handle large integers in JSON without encountering this error?
Error message:
java.lang.IllegalStateException: There is an error on reading the JSON. JSON integer 100000000000000000000 is too large or small for an Int64. Path 'invalidNumber', line 1, position 38.
Here is a snippet of the code where the error occurs:
String invalidJsonString = "{\"invalidNumber\":100000000000000000000}";
ByteArrayInputStream dsByteStream = new ByteArrayInputStream(
invalidJsonString.getBytes(StandardCharsets.UTF_8));
JsonDataLoadOptions options = new JsonDataLoadOptions();
options.setSimpleValueParseMode(JsonSimpleValueParseMode.STRICT);
JsonDataSource dataSource = new JsonDataSource(dsByteStream, options);
I am using aspose-words
version 24.1
.
Thanks in advance.