Replace WriteHeader() + RenderJSON() pattern with EncodeJSON() which properly sets Content-Type header before writing status code. The previous pattern caused Content-Type to default to text/plain instead of application/json, breaking frontend JSON parsing. Fixes #1979