NumberFormatException when deserializing a 128-bit integer
See original GitHub issueIssue Description
Using "com.lihaoyi" %% "ujson" % "0.6.6"
val json = ujson.read("{'foo': 28291041994989161181883157038606177750}")
yields:
28291041994989161181883157038606177750
java.lang.NumberFormatException: 28291041994989161181883157038606177750
at ujson.util.Util$.parseLong(Util.scala:57)
at ujson.util.Util$.parseIntegralNum(Util.scala:23)
at ujson.Js$.visitNum(Js.scala:181)
at ujson.Js$.visitNum(Js.scala:77)
at ujson.Parser.parseNum(Parser.scala:171)
at ujson.Parser.rparse(Parser.scala:404)
at ujson.Parser.parse(Parser.scala:330)
at ujson.Parser.parse(Parser.scala:325)
at ujson.SyncParser.parse(SyncParser.scala:23)
at ujson.StringParser$.transform(StringParser.scala:28)
at ujson.StringParser$.transform(StringParser.scala:27)
at ujson.Transformable$fromTransformer.transform(Transformable.scala:13)
at ujson.package$.transform(package.scala:2)
at ujson.package$.read(package.scala:4)
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
NumberFormatException when deserializing a 128-bit integer
It seems to me that the ujson AST is not correct. Would it be possible to fix it rather than suggesting to switch...
Read more >java - What is a NumberFormatException and how can I fix it?
This exception is thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that...
Read more >Serialized Form (Java SE 19 & JDK 19) - Oracle Help Center
Read an applet from an object input stream. Parameters: s - the ObjectInputStream to read; Throws: ClassNotFoundException - if the class of a...
Read more >org.bson.types.Decimal128.<init> java code examples - Tabnine
Create an instance with the given high and low order bits representing this Decimal128 as an IEEE 754-2008 128-bit decimal * floating point...
Read more >Decimal128 (The Adobe AEM Quickstart and Web Application.)
A binary integer decimal representation of a 128-bit decimal value, supporting 34 ... NumberFormatException - if the value is out of the Decimal128...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Note that unlike other JSON libraries, ujson.Value isn’t blessed in any way, so if you use a uJson with a different AST you need not worry about ujson.Value tradeoffs at all. In fact, internally uPickle defines its own IndexedValue AST for cases where we need the source indices and non-lossy temporary storage of the incoming JSON, and in most cases does not use an AST at all. So you don’t need to feel bad about defining your own AST for your own use case
The uJson AST is designed to mimic the Javascript AST, which takes only numbers. If you want something else, use a different AST (or don’t use an AST, like uPickle)