Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6749415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:41:15+00:00 2026-05-26T12:41:15+00:00

I am working on a simple app engine application that utilize the geo-searching proximity_fetch.

  • 0

I am working on a simple app engine application that utilize the geo-searching proximity_fetch.

I perform the search and some extra filtering on the data, and all goes well (I checked the number of returned results, and it was just as expected ) However, when I tried to dump it into a json using simple json, I got the following error:

TypeError: < backend.models.Listing object at 0x0570CC90 >is not JSON serializable

This is the way I define the object in my code:

class Listing(GeoModel):
    currency=db.IntegerProperty( default = CURRENCY["EURO"] )
    title=db.StringProperty(required = True )
    admins = db.ReferenceProperty( User )
    .
    . Some uninteresting properties goes here, Only Integer and String Properties
    .
    active = db.BooleanProperty()

    @staticmethod
    def get_listing_from_point( lat , lon ,
                            max_dist=MAX_SEARCH_RADIUS,
                            max_result=MAX_SEARCH_RESULT,
                            start_date=None,end_date=None):

        rich_query = Listing.all()
        result = Listing.proximity_fetch( rich_query , 
                                          geo.geotypes.Point( lat , lon ),
                                          max_results = max_result,
                                          max_distance = max_dist )

        result =  list( rich_query )

        valid_list = 
           [i for i in list( result ) if i.check_availability( start_date , 
                                                               end_date )]

        return  valid_list 

And this is the method from which I call the proximity search:

lon = self.request.args.get("lon" , None)
lat = self.request.args.get("lat" , None)
check_in = self.request.args.get("check_in" , None)
check_out = self.request.args.get("check_out" , None)
if not lon or not lat:
   return Response( json.dumps( "{ 'error' : 'desription..." ) )

result = Listing.get_listing_from_point(
                                lat = float(lat),
                                lon = float(lon),
                                start_date = check_in,
                                end_date = check_out)

return json.dumps( result )

While attempting to find the reason for the problem, I tried to return the dict of the first result in the search, and when I did so, I got the following error:

TypeError: datastore_types.GeoPt(23.0, 42.2) is not JSON serializable
Which leads me to believe there is something wrong in the way I handle my geo points…

I tried searching for both errors with no result, any clues?

P.S, this is the complete stacktrace:

File “C:\Program >Files\Google\google_appengine\google\appengine\ext\appstats\recording.py”, line 897, in >appstats_wsgi_wrapper
result = app(environ, appstats_start_response)

File “C:\Users\roi.SEMANTV\PycharmProjects\gayville_tipfy\tipfy\app.py”, line 245, in >dispatch
rv = self.handle_exception(request, e)

File “C:\Users\roi.SEMANTV\PycharmProjects\gayville_tipfy\tipfy\app.py”, line 241, in >dispatch
rv = self.router.dispatch(request)

File “C:\Users\roi.SEMANTV\PycharmProjects\gayville_tipfy\tipfy\routing.py”, line 105, in >dispatch
rv = rv()

File “C:\Users\roi.SEMANTV\PycharmProjects\gayville_tipfy\tipfy\handler.py”, line 297, in >call
response = self.dispatch()

File “C:\Users\roi.SEMANTV\PycharmProjects\gayville_tipfy\tipfy\handler.py”, line 88, in >dispatch
return self.handle_exception(exception=e)

File “C:\Users\roi.SEMANTV\PycharmProjects\gayville_tipfy\tipfy\handler.py”, line 86, in >dispatch
return self.make_response(method(**request.rule_args))

File “C:\Users\roi.SEMANTV\PycharmProjects\gayville_tipfy\backend\handlers.py”, line 47, >in get
return json.dumps( result )

File “C:\Program >Files\Google\google_appengine\lib\django_0_96\django\utils\simplejson__init__.py”, line >182, in dumps
**kw).encode(obj)

File “C:\Program >Files\Google\google_appengine\lib\django_0_96\django\utils\simplejson\encoder.py”, line >312, in encode
chunks = list(self.iterencode(o))

File “C:\Program >Files\Google\google_appengine\lib\django_0_96\django\utils\simplejson\encoder.py”, line >262, in _iterencode
for chunk in self._iterencode_list(o, markers):

File “C:\Program >Files\Google\google_appengine\lib\django_0_96\django\utils\simplejson\encoder.py”, line >170, in _iterencode_list
for chunk in self._iterencode(value, markers):

File “C:\Program Files\Google\google_appengine\lib\django_0_96\django\utils\simplejson\encoder.py”, line 273, in _iterencode
for chunk in self._iterencode_default(o, markers):

File “C:\Program >Files\Google\google_appengine\lib\django_0_96\django\utils\simplejson\encoder.py”, line 279, in _iterencode_default
newobj = self.default(o)

File “C:\Program >Files\Google\google_appengine\lib\django_0_96\django\utils\simplejson\encoder.py”, line >300, in default
raise TypeError(“%r is not JSON serializable” % (o,))

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:41:16+00:00Added an answer on May 26, 2026 at 12:41 pm

    Complex Python objects must be representable as a dictionary of simple types in order to serialize to JSON. The “object is not JSON serializable” error basically means that Python’s JSON encoder did not know how to serialize your object.

    So if result is a GeoPt, you can serialize it like this:

    return json.dumps({'lat': result.lat, 'lon': result.lon})

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a simple web application through Google App engine using
I am working on a simple app tab-bar based application that has two views.
I'm working with a simple app, that allows user to enter some text, then
I'm working on an application that will run on Google App Engine. I would
I am currently working on a simple Silverlight app that will allow people to
I'm working on a simple spell checking app for a lecture that I'm giving.
I'm in lean startup mode, working on a simple phone app that will be
I am developing a Java application using Google App Engine that depends on a
OK, well I've been working on a simple app that allows users to save
I'm working on a localized Django app with a simple forum. Some posts' timestamps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.