public int getInt(String key) throws JSONException {
        Object o = get(key);
        if(o==null)  return 0;
        return o instanceof Number ?
                ((Number)o).intValue() : (int)getDouble(key);
    }