Int64 in JSON

2,202 views
Skip to first unread message

Pablo Martin

unread,
Jun 13, 2017, 6:54:26 AM6/13/17
to Haxe
Hi!

I need to work with Int64 numbers in Json and it should be sent to the server, but a problem occurs. When I use Json.stringify it is converted to the {"hi":0,"lo":0} object. So it isn't valid to communicate with the server.

Any suggestion?

Thanks in advance.

Franco Ponticelli

unread,
Jun 13, 2017, 11:00:12 AM6/13/17
to Haxe
JSON supports only a few basic types and Int64 (or Date) are not part of it. You need to find a way to deal with those types manually by using another representation. You could simply stringify the Int64 value and parse it on the server side.

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Norbert Melzer

unread,
Jun 13, 2017, 1:05:20 PM6/13/17
to Haxe

The JSON standard does not specify any bounds on numbers, the syntax specification does neither, so in fact even BigInts can be dumped into JSON. One should make sure though that the target system does understand those numbers as well.

Pablo Martin

unread,
Jun 13, 2017, 1:42:18 PM6/13/17
to Haxe
Ok, thanks for the suggestions. I thought I would need something like that.

Regards.
Reply all
Reply to author
Forward
0 new messages