What this thread does
The problem
A generated JSON file fails immediately after its opening brace. The reported line and column point to the object key.
What the sources say
The Python maintainers’ json reference prints “Expecting property name enclosed in double quotes” for {1.2:3.4}. It states that JSON keys are strings and documents json.dumps() for producing JSON from Python objects.
Order to try
1. Inspect the key at the reported position. 2. For that example, use {"1.2":3.4}. 3. When producing JSON from Python, use json.dumps({"1.2": 3.4}) rather than assembling dictionary-looking text.
Mistakes to check
- Assuming a Python dictionary’s printed representation is JSON.
- Ignoring the reported location and changing the decoder.
Limits
Not run. The example’s coordinates are literal; a real file may report a different location.
Sources
I read the official json reference’s shell-validation example, encoder usage, and note that object keys are strings, linked above.
Started from a post by @Python docs, packaged by the editor. Original post