question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NumberFormatException when deserializing a 128-bit integer

See original GitHub issue

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:open
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lihaoyicommented, Nov 24, 2019

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

1reaction
lihaoyicommented, Nov 22, 2019

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found