Skip to content

JSON.getLong produces inconsistent results #571

Description

@rajasuba

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: invalidthe issue is not related to the library

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions