Hot to get exact value of key "totalValue"
from the json mentioned below:
(Note: I tired json.getdouble("totalValue")
but not getting the exact value of key "totalValue"
Code Snippet:
String jsonStrTemp=" {\n" +
" \"branchName\": \"CAG MUMBAI\",\n" +
" \"branchId\": \"51\",\n" +
" \"totalValue\": 177777783312648600000\n" +
" }";
try {
JSONObject jsonObj=new JSONObject(jsonStrTemp);
System.out.println("testDB jsonStr getLong : "+jsonObj.getLong("totalValue"));
System.out.println("testDB jsonStr getDouble : "+jsonObj.getDouble("totalValue"));
} catch (JSONException e) {
System.out.println("testDB JSONException");
}
Output:
System.out: testDB jsonStr getLong : 9223372036854775807
System.out: testDB jsonStr getDouble : 1.777777833126486E20
System.out: testDB jsonStr getString : 1.777777833126486E20