Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search in forums












SourceForge.net Logo



Home » Developing U++ » Bugs (& fixes) » int64 in JSON
int64 in JSON [message #47339] Thu, 05 January 2017 11:33 Go to next message
akebee is currently offline  akebee
Messages: 67
Registered: August 2011
Member
hi, the AsJSON cannot deal with int64 value,

the code
	Value item_id = 6364210481850221057;
	DUMP(AsJSON(item_id));


will log a double value,
how to fix it? Razz


i didn`t see th stickey! sorry to post here , help me to move to appropriate form Cool

[Updated on: Thu, 05 January 2017 11:35]

Report message to a moderator

Re: int64 in JSON [message #47342 is a reply to message #47339] Thu, 05 January 2017 14:26 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1730
Registered: August 2008
Location: Czech Republic
Senior Veteran

akebee wrote on Thu, 05 January 2017 11:33
hi, the AsJSON cannot deal with int64 value,

the code
	Value item_id = 6364210481850221057;
	DUMP(AsJSON(item_id));


will log a double value,
how to fix it? Razz

That is not a bug, that is a feature Smile This is because javascript doesn't have int64. Only values less than 2^52 are supported for integers, higher numbers are converted to double (an loose precision!).

Best regards,
Honza
Re: int64 in JSON [message #47343 is a reply to message #47342] Thu, 05 January 2017 14:31 Go to previous messageGo to next message
akebee is currently offline  akebee
Messages: 67
Registered: August 2011
Member
its sad Sad

now i have to write a json like blow:
{
	"item_id": 6364210481850220544,
	"value": 6284399068525478145,
}


how to do it in U++ Crying or Very Sad
Re: int64 in JSON [message #47348 is a reply to message #47339] Thu, 05 January 2017 23:19 Go to previous message
mr_ped is currently offline  mr_ped
Messages: 776
Registered: November 2005
Location: Czech Republic - Praha
Veteran

Export it as string.

{
	"item_id": "6364210481850220544",
	"value": "6284399068525478145",
}


Then also import as string. Then convert back to int64 (I would expect "id" to be rather uint64).
Previous Topic: Problem with FreeBSD
Next Topic: DO NOT POST NEW TOPICS TO THIS FORUM!!!
Goto Forum:
  


Current Time: Thu Mar 23 01:23:04 CET 2017

Total time taken to generate the page: 0.01929 seconds