public long getLong(String key) throws JSONException {
        Object o = get(key);
        
        if(o==null)  return 0;
        if(o instanceof String){
        	if(o.toString().length()>0){
        		return Long.valueOf((o.toString()));
        	}else
        		return 0;
        }
        return o instanceof Number ?
                ((Number)o).longValue() : (long)getDouble(key);
    }