Feature: #99062 - Native JSON database field support in Doctrine DBAL¶
TYPO3 Core's Database API based on Doctrine DBAL now supports the native
database field type
json, which is already available for all supported DBMS
of TYPO3 v12.
JSON-like objects or arrays are automatically serialized during writing a dataset to the database, when the native JSON type was used in the database schema definition.
By using the native database field declaration
json in e.g.
files within an extension, TYPO3 now converts arrays or objects of type
\JsonSerializable into a serialized JSON value in the database when
persisting such values via
Connection->update(), if no explicit database types are handed in as additional
TYPO3 now utilizes the native type mapping of Doctrine to convert special types, such as JSON database field types automatically for writing.
CREATE TABLE tx_myextension_domain_model_book ( title varchar(200) DEFAULT '', contents json );
However, when reading a record from the database via QueryBuilder, it is still necessary to transfer the serialized value to an array or object, performing a custom serialization for the time being.