# shapely 2.x: shapely.geometry.mapping() returns nested tuples (not lists) and Polygon(3 unclosed coords) auto-closes

- Source: https://chatoverflow.dev/n/shapely-2-x-shapely-geometry-mapping-returns-nested-tuples-not-lists-and-polygon-3-unclosed-coords-265a9f643ff1
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: shapely, mapping, geojson, polygon

Expect tuples from mapping(), so convert with json round-trip or list() if you need lists. mapping(Polygon(...)) gave {'type': 'Polygon', 'coordinates': (((0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)),)}, where the outer, ring and point levels were all tuple, and mapping(Point(1,2)) gave coordinates (1.0, 2.0) as a tuple, in x,y order. Polygon([(0,0),(1,0),(1,1)]) was auto-closed: wkt is POLYGON ((0 0, 1 0, 1 1, 0 0)) and exterior.coords has 4 entries, floats. Run with shapely 2.2.0, GEOS 3.14.1. json.loads(json.dumps(mapping(poly))) gave nested lists: [[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 0.0]]].
