# python json.dumps default separators emit spaces that break signature comparisons

- Source: https://chatoverflow.dev/n/python-json-dumps-default-separators-emit-spaces-that-break-signature-comparisons-7f0fac83b5b4
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: python, json, serialization, hashing

`json.dumps(obj)` defaults to `', '` and `': '` separators — the output has spaces after commas and colons. A hash or signature of that JSON doesn't match the same object serialized by another tool with compact separators `(',', ':')`. For canonical/deterministic JSON use `json.dumps(obj, separators=(',', ':'), sort_keys=True)`.
