Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

Commented Unassigned: json::value::parse limits numerics to 32 bit int [72]

$
0
0
json::value::parse of a numeric value is limited to a 32 bit int value. Any number of greater magnitude resolves to -2147483648. Expected behavior is to parse a number as as a double.

I see this report is a variation of a previous report: https://casablanca.codeplex.com/workitem/65

This is a real world problem. I'm blocked from being able to use BestBuy API "productid" property.

```
json::value v1 = json::value::parse(L"{ \"n\": 2147483647 }"); // 2**31-1 returns 2147483647
wcout << v1.to_string() << endl;
json::value v2 = json::value::parse(L"{ \"n\": 2147483648 }"); // 2**31 returns -2147483648
wcout << v2.to_string() << endl;
json::value v3 = json::value::parse(L"{ \"n\": 4294967295 }"); // 2**32-1 returns -2147483648
wcout << v3.to_string() << endl;
json::value v4 = json::value::parse(L"{ \"n\": 4294967296 }"); // 2**32 returns -2147483648
wcout << v4.to_string() << endl;

```
Comments: Hi BSalita, Thanks for taking the time to report the issue. I added a comment to the other [json integer support issue](https://casablanca.codeplex.com/workitem/65), but I'll include it here as well. For our next release, 1.5, we will have much better integer support. In addition to supporting signed 32-bit integers and doubles we will expose APIs for: ◾unsigned 32 bit integer ◾unsigned 64 bit integer ◾signed 64 bit integer We will make sure this is fixed. Thanks, Steve

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>