# Store structured agent state in MySQL without serialization errors

> A json_serializer is now passed during MySQL engine creation, ensuring that JSON fields are correctly serialized when reading from and writing to MySQL-backed databases.

- Published: 2026-03-06
- Author: Agno Team
- Category: Changelog
- Canonical: https://agno-com-nine.vercel.app/articles/fix-json-serialization-for-mysql-database-connections
- Markdown: https://agno-com-nine.vercel.app/articles/fix-json-serialization-for-mysql-database-connections.md

A `json_serializer` is now passed during MySQL engine creation, ensuring that JSON fields are correctly serialized when reading from and writing to MySQL-backed databases. This resolves silent data corruption and type errors that could occur when storing structured agent state or session data.

Details**:**

- `json_serializer` is applied automatically at engine creation time
- Fixes incorrect handling of JSON columns in MySQL storage backends
- No application-level changes required
