Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON.getLong produces inconsistent results #571

Closed
rajasuba opened this issue Apr 27, 2017 · 1 comment
Closed

JSON.getLong produces inconsistent results #571

rajasuba opened this issue Apr 27, 2017 · 1 comment
Labels
solution: invalid the issue is not related to the library

Comments

@rajasuba
Copy link

Json.getLong produces inconsistent results. Here is the following sample snippet which produces different results across different machine with the same JDK version and same JSON jar

        `String str = "26315000000253009";
	JSONObject json = new JSONObject();
	json.put("key", str);
	
	System.out.println("The value of json.get is  : " +json.get("key"));
	System.out.println("The value of json.getLong is : "+json.getLong("key"));
	System.out.println("The value of json.getString is : "+json.getString("key"));`

Different results

The value of json.get is : 26315000000253009
The value of json.getLong is : 26315000000253008
The value of json.getString is : 26315000000253009

The value of json.get is : 26315000000253009
The value of json.getLong is : 26315000000253009
The value of json.getString is : 26315000000253009

*JSON version * : 2.0
MD5Sum value of Json jar : 2f7f899f0766e65017744a4c4fc14d46
*JDK Version * : 1.8.0_92

What could be the reason for this inconsistent results? It would be great help if someone could help me know about this.

@nlohmann
Copy link
Owner

I think this is the wrong library you are filing an issue for. This is "JSON for Modern C++", but your example shows Java code.

@nlohmann nlohmann added the solution: invalid the issue is not related to the library label Apr 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: invalid the issue is not related to the library
Projects
None yet
Development

No branches or pull requests

2 participants