Skip to content

Instantly share code, notes, and snippets.

@kerin
Created March 5, 2015 16:01
Show Gist options
  • Save kerin/26a52bf3221e549380c7 to your computer and use it in GitHub Desktop.
Save kerin/26a52bf3221e549380c7 to your computer and use it in GitHub Desktop.
class ShortGeoJSONEncoder(json.JSONEncoder):
def default(self, obj):
print 'GEOJSON'
if type(obj) == float:
#return float("{:.6f}".format(obj))
return 'FOO'
else:
return 'BAR'
#return json.JSONEncoder.default(self, obj)
print json.dumps(geojson, cls=ShortGeoJSONEncoder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment