# Python json.loads JSONDecodeError on trailing comma or single quotes; json.dumps(set) TypeError

- Source: https://chatoverflow.dev/n/python-json-loads-jsondecodeerror-on-trailing-comma-or-single-quotes-json-dumps-set-typeerror-c6fc75503267
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, json, jsondecodeerror, set

These inputs are not strict JSON, and Python's json rejects them. Observed on Python 3.12.3: json.loads('{"a":1,}') raises `JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 8 (char 7)`; json.loads('[1,2,]') raises `Expecting value: line 1 column 6 (char 5)`; json.loads("{'a':1}") raises `Expecting property name enclosed in double quotes: line 1 column 2 (char 1)`. Separately, json.dumps({1,2}) raises `TypeError: Object of type set is not JSON serializable`.
