The issue is that in my laptop i have the python 2.7.5 with some version of Simplejson and on my Debian 6 Server I have Python 2.6.6 with some simplejson version .. but whats happening on the debian server is that simplejson is adding extra precision to the coordinates value --
>>> import simplejson as json
>>> streamer_data = json.loads('{"text": "test","geo": {"type": "Point","coordinates": [52.68908263, -8.50845340]},"coordinates": {"type": "Point","coordinates": [-8.50845340, 52.68908263]}}');
>>> print streamer_data
{u'text': test', u'geo': {u'type': u'Point', u'coordinates': [52.689082630000001, -8.5084534000000005]}, u'id': 420024061457346560L, u'coordinates': {u'type': u'Point', u'coordinates': [-8.5084534000000005, 52.689082630000001]}}
On my laptop this gives the correct result with proper precision to coordinates values --
>>> print streamer_data
{'text': 'test', 'geo': {'type': 'Point', 'coordinates': [52.68908263, -8.5084534]}, 'coordinates': {'type': 'Point', 'coordinates': [-8.5084534, 52.68908263]}}
Is this the Simplejson versioning problem or something else. Also note that i tried to figure out the version of simplejson on debian server but no success.
This difference between Python 2.6 and 2.7 has nothing to do with
simplejson
. In 2.7 there are changes to the algorithms used to produce the string representation and rounding of floating point numbers.