JSON auto adding backslashes

234 Views Asked by At

I'm trying to pass a GeoJson response that comes from a function called db.session.query(func.ST_AsGeoJSON(self.geometry)).first(), using GeoAlchemy and PostGres. When printing, shows:

('{"type":"Polygon","coordinates":[[[-38.4105,-12.9232],[-38.4205,-12.9232],[-38.4305,-12.9232],[-38.4505,-12.9232],[-38.4105,-12.9232]]]}',)

But when i try to add this to other Json, like that:

    geojson = {
        'geometry': db.session.query(func.ST_AsGeoJSON(self.geometry)).first(),
        'type': 'Feature',
        'properties': {
            'Nome': 'Default',
            'Qualidade': 'Default'
        },
    }

The response that comes to the website is full of backslashes:

enter image description here

I need to properly pass the geometry response to the geojson.

0

There are 0 best solutions below