# JSON parser silently reads BOM character as part of first key name

- **ID:** `data/json-utf8-bom-silent-read`
- **Domain:** data
- **Category:** encoding_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Files saved with UTF-8 BOM (Byte Order Mark, \ufeff) by Windows editors cause JSON parsers that do not strip BOM to include it in the first key name, leading to key lookup failures and silent data corruption.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Python 3.11 | active | — | — |
| Python 3.12 | active | — | — |
| Node.js 20 | active | — | — |
| jq 1.7 | active | — | — |

## Workarounds

1. **Open file with utf-8-sig encoding before parsing: `with open('data.json', encoding='utf-8-sig') as f: data = json.load(f)`** (95% success)
   ```
   Open file with utf-8-sig encoding before parsing: `with open('data.json', encoding='utf-8-sig') as f: data = json.load(f)`
   ```
2. **Strip BOM from file content before parsing: `content = open('data.json', 'rb').read().lstrip(b'\xef\xbb\xbf'); data = json.loads(content)`** (93% success)
   ```
   Strip BOM from file content before parsing: `content = open('data.json', 'rb').read().lstrip(b'\xef\xbb\xbf'); data = json.loads(content)`
   ```

## Dead Ends

- **** — Python's json.load does not accept encoding parameter; you must use open() with encoding='utf-8-sig' before json.load. (50% fail)
- **** — This modifies the source file and may be forgotten in CI/CD pipelines; also requires root access in some environments. (40% fail)
- **** — This breaks all key lookups in downstream code and makes the code non-portable across different editors. (90% fail)
