Christian López Espínola Explains JSON Key-Order Issue in Drupal Canvas

Cross-Database JSON Behaviour Behind CI Failures
Introducing Drupal Canvas: Webhaven’s New Visual Page Builder
Webhaven

Database engines handled JSON key order differently in Drupal Canvas tests, Drupal contributor Christian López Espínola writes in a 4 July 2026 post on the Penyaskito blog. In Canvas Internals - JSON data types in different databases: It works on my machine!, Christian explains how Canvas uses a JSON field for component tree item inputs while Drupal core work to add a JSON data type remains unfinished.

The problem appeared when tests compared stored inputs with assertSame. Christian says the same data could come back with different key ordering depending on the database engine: MySQL and PostgreSQL could change the order, while MariaDB and SQLite preserved it in the cases tested. That difference meant tests could pass in local environments that used SQLite or MariaDB but fail in continuous integration on MySQL and PostgreSQL.

The Canvas team addressed the issue with a custom assertSameInputs helper that sorts keys before comparison, along with a PHPStan rule that flags most uses of assertSame for these inputs. Christian connects the issue to work on symmetric translation support in Drupal Canvas. The Canvas 1.7.0 release notes say translation support is still experimental and should be tested only on non-production sites.

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Drupal Initiatives

Upcoming Events

Latest Opportunities