0

I am developing a program that uses the twitter api. When I tweet an id is returned. This id is of type long but I save it as "Long". When I try to use it in the interface with AJAX, I see that the id is rounded to the nearest number. For example correct id = 1490964930547310594 but what I am displaying on screen is 1490964930547310600. How can I solve this problem? I've never had this problem with thymeleaf. It happened when I started using to angularJs.

I'm converting the id from Mikroservice to Long type: tweet.setStatusId(Long.parseLong(resp.get("statusId").toString()));

  • 2
    Looks like JavaScript `double` problems to me. See https://stackoverflow.com/q/9643626/2071828 – Boris the Spider Feb 08 '22 at 08:33
  • A workaround might be passing it around as a string instead. Completely depends on how much influence you have over the serialization and your application's needs. – Mark Clark Feb 09 '22 at 21:38

0 Answers0