Towards a JSON API for the JDK

Naoto Sato naoto.sato at oracle.com
Mon May 19 18:02:28 UTC 2025


Hi,

On 5/17/25 10:55 PM, Cay Horstmann wrote:
> PS. Trying to create and show the youthful John gives me grief right now:
> 
> Json.fromUntyped(Map.of("name", "John", "age", 30)).toString()
> |  Exception java.lang.NullPointerException: Cannot read the array 
> length because "value" is null
> |        at String.rangeCheck (String.java:307)
> |        at String.<init> (String.java:303)
> |        at JsonNumberImpl.toString (JsonNumberImpl.java:105)
> |        at JsonObjectImpl.toString (JsonObjectImpl.java:56)
> |        at (#23:1)
> 
> The JsonNumberImpl.toString method needs to handle the case that it was 
> constructed from a Number.

I could not reproduce it with the current branch. Could you please 
elaborate it more?

Naoto


More information about the core-libs-dev mailing list