GenerateJSON cannot handle high UInt64 values

This works:

t = Xojo.Data.GenerateJSON( &h7FFFFFFFFFFFFFFF )

Add 1 to the value and it doesn’t:

t = Xojo.Data.GenerateJSON( &h8000000000000000 )

An InvalidArgumentException is raised on the latter. Before I file a report, is this by design?

I’d try
dim t as text
dim i as int64 = &h8000000000000000
t = Xojo.Data.GenerateJSON( i )

I suspect the literal is not being turned into the type you think it is

I’d still file a bug report though as the exception is stating root: Value 9223372036854775808 is outside of the maximum range of an Int64

Ah, I missed that in the message. So that explains it, you can store Int64( &h8000000000000000 ) but not UInt64 of the same bytes. I just confirmed that that’s true.

This does not work:

  dim i as UInt64 = &h7FFFFFFFFFFFFFFF
  dim t as text = Xojo.Data.GenerateJSON( i )
  
  dim one as Int64 = 1
  
  i = i + one
  t = Xojo.Data.GenerateJSON( i )

But this does:

  dim i as Int64 = &h7FFFFFFFFFFFFFFF
  dim t as text = Xojo.Data.GenerateJSON( i )
  
  dim one as Int64 = 1
  
  i = i + one
  t = Xojo.Data.GenerateJSON( i )

That presents a workaround at least, but I’ll file a bug report anyway.

<https://xojo.com/issue/39056>