diff --git a/tinydb/database.py b/tinydb/database.py
index 31a7483..cdaad19 100644
--- a/tinydb/database.py
+++ b/tinydb/database.py
@@ -199,7 +199,7 @@ class Table(object):
 
         old_ids = self._read().keys()
         if old_ids:
-            self._last_id = max(int(i, 10) for i in old_ids)
+            self._last_id = max(i for i in old_ids)
         else:
             self._last_id = 0
 
@@ -257,10 +257,11 @@ class Table(object):
         :rtype: dict
         """
 
-        data = self._db._read(self.name)
-
-        for eid in list(data):
-            data[eid] = Element(data[eid], eid)
+        raw_data = self._db._read(self.name)
+        data = {}
+        for key in list(raw_data):
+            eid = int(key)
+            data[eid] = Element(raw_data[key], eid)
 
         return data
 

Can not handle data by integer eid
The id of the element will change to a unicode string after JSON serialization/deserialization. This causes no way to get the element by integer eid.

```python
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tinydb import TinyDB
>>> db=TinyDB('/tmp/test.json')
>>> db.insert({'foo':'bar'})
1
>>> db.all()
[{u'foo': u'bar'}]
>>> element = db.all()[0]
>>> element.eid
u'1'
>>> assert db.get(eid=1) is not None
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
>>> assert db.get(eid='1') is not None
>>> db.update({'foo':'blah'}, eids=[1])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/wolfg/.virtualenvs/opensource/lib/python2.7/site-packages/tinydb/database.py", line 335, in update
    cond, eids)
  File "/Users/wolfg/.virtualenvs/opensource/lib/python2.7/site-packages/tinydb/database.py", line 222, in process_elements
    func(data, eid)
  File "/Users/wolfg/.virtualenvs/opensource/lib/python2.7/site-packages/tinydb/database.py", line 334, in <lambda>
    self.process_elements(lambda data, eid: data[eid].update(fields),
KeyError: 1
>>> db.update({'foo':'blah'}, eids=['1'])
>>> db.all()
[{u'foo': u'blah'}]
>>> db.contains(eids=[1])
False
>>> db.contains(eids=['1'])
True
```
diff --git a/tests/test_tinydb.py b/tests/test_tinydb.py
index 6f4e435..35b6fc1 100644
--- a/tests/test_tinydb.py
+++ b/tests/test_tinydb.py
@@ -337,3 +337,34 @@ def test_unicode_json(tmpdir):
         assert _db.contains(where('value') == unic_str1)
         assert _db.contains(where('value') == byte_str2)
         assert _db.contains(where('value') == unic_str2)
+
+
+def test_eids_json(tmpdir):
+    """
+    Regression test for issue #45
+    """
+    
+    path = str(tmpdir.join('db.json'))
+
+    with TinyDB(path) as _db:
+        _db.purge()
+        assert _db.insert({'int': 1, 'char': 'a'}) == 1
+        assert _db.insert({'int': 1, 'char': 'a'}) == 2
+        
+        _db.purge()
+        assert _db.insert_multiple([{'int': 1, 'char': 'a'},
+                                   {'int': 1, 'char': 'b'},
+                                   {'int': 1, 'char': 'c'}]) == [1, 2, 3]
+        
+        assert _db.contains(eids=[1, 2])
+        assert not _db.contains(eids=[88])
+        
+        _db.update({'int': 2}, eids=[1, 2])
+        assert _db.count(where('int') == 2) == 2
+       
+        el = _db.all()[0]
+        assert _db.get(eid=el.eid) == el
+        assert _db.get(eid=float('NaN')) is None
+
+        _db.remove(eids=[1, 2])
+        assert len(_db) == 1

pip install -e .[dev]
parse_log_pytest
pytest
pytest
3.4
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
-e git+https://github.com/msiemens/tinydb.git@65c302427777434c3c01bf36eb83ab86e6323a5e#egg=tinydb
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: tinydb
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/tinydb

tests/test_tinydb.py::test_eids_json
tests/test_tinydb.py::test_purge[db0] tests/test_tinydb.py::test_purge[db1] tests/test_tinydb.py::test_all[db0] tests/test_tinydb.py::test_all[db1] tests/test_tinydb.py::test_insert[db0] tests/test_tinydb.py::test_insert[db1] tests/test_tinydb.py::test_insert_ids[db0] tests/test_tinydb.py::test_insert_ids[db1] tests/test_tinydb.py::test_insert_multiple[db0] tests/test_tinydb.py::test_insert_multiple[db1] tests/test_tinydb.py::test_insert_multiple_with_ids[db0] tests/test_tinydb.py::test_insert_multiple_with_ids[db1] tests/test_tinydb.py::test_remove[db0] tests/test_tinydb.py::test_remove[db1] tests/test_tinydb.py::test_remove_multiple[db0] tests/test_tinydb.py::test_remove_multiple[db1] tests/test_tinydb.py::test_remove_ids[db0] tests/test_tinydb.py::test_remove_ids[db1] tests/test_tinydb.py::test_update[db0] tests/test_tinydb.py::test_update[db1] tests/test_tinydb.py::test_update_transform[db0] tests/test_tinydb.py::test_update_transform[db1] tests/test_tinydb.py::test_update_ids[db0] tests/test_tinydb.py::test_update_ids[db1] tests/test_tinydb.py::test_search[db0] tests/test_tinydb.py::test_search[db1] tests/test_tinydb.py::test_contians[db0] tests/test_tinydb.py::test_contians[db1] tests/test_tinydb.py::test_get[db0] tests/test_tinydb.py::test_get[db1] tests/test_tinydb.py::test_get_ids[db0] tests/test_tinydb.py::test_get_ids[db1] tests/test_tinydb.py::test_count[db0] tests/test_tinydb.py::test_count[db1] tests/test_tinydb.py::test_contains[db0] tests/test_tinydb.py::test_contains[db1] tests/test_tinydb.py::test_contains_ids[db0] tests/test_tinydb.py::test_contains_ids[db1] tests/test_tinydb.py::test_get_idempotent[db0] tests/test_tinydb.py::test_get_idempotent[db1] tests/test_tinydb.py::test_multiple_dbs tests/test_tinydb.py::test_unique_ids tests/test_tinydb.py::test_lastid_after_open
tinydb/database.py
tinydb/database.py