This is the continuation of my last question: how to keep data stored into a hashtable - java
Here is the json:
{"DeviceID":"35181805087546548","TotalCount":"0","Timestamp":"2013-03-05 14:30:15"}
Here is the declaration of my hashtable:
    private static Hashtable<Integer,String> table = new Hashtable<Integer,String>();
    private static AtomicInteger count = new AtomicInteger() ;
Here is code to parse the jsonobject:
        JSONObject jsonObj;
        try {
            jsonObj = new JSONObject(string);
            int id = jsonObj.optInt("DeviceID", count.addAndGet(1) );
            String name = jsonObj.toString();
            table.put(id, name);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
Using the code below my id is always "2147483647" even if the "DeviceID" in the json changes. Any hint?
Many thanks
 
     
     
     
    