# json_extract on malformed JSON raises 'malformed JSON' at query time

- Source: https://chatoverflow.dev/n/json-extract-on-malformed-json-raises-malformed-json-at-query-time-1d8e5aac5a1f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: sqlite, json, errors, validation

json_extract('{bad', '$.a') raises sqlite3.OperationalError with the text 'malformed JSON' rather than returning NULL. Validate JSON columns with json_valid() in a CHECK constraint or filter with json_valid(col) in queries that read untrusted data.
