Merged
Size
M
Change Breakdown
Bug Fix95%
Maintenance5%
#28242fix: Handle normalization of JSON for SQLite / postgres

Entity imports now work across SQLite and Postgres

Importing n8n entities between SQLite and Postgres databases should now succeed without silent JSON corruption in workflows and credentials.

Entity imports between SQLite and Postgres were failing because the two databases store JSON differently. SQLite stores JSON columns as plain text, while Postgres stores them as native JSON objects. When exporting from SQLite, JSON fields came out as strings. When exporting from Postgres, they came out as parsed objects. The raw SQL import would then receive data in the wrong format for the target database.

A new normalization step now inspects each JSON column before insertion. String values (from SQLite exports) are parsed and re-serialized to canonical JSON. Object values (from Postgres exports) are serialized to strings. Both formats are then valid for any database driver handling json or simple-json columns.

This fix resolves silent data corruption that would otherwise produce malformed JSON stored in workflows, credentials, and other entities. The import pipeline in the CLI package now reliably transfers data between different database backends.

View Original GitHub Description

Summary

<!-- Describe what the PR does and how to test. Photos and videos are recommended. -->

This PR handles an issue where JSON exports from SQLite differ from Postgres, which causes issues on simple json and JSON fields.

With this fix, data is normalized based on the shape of data before insertion

Related Linear tickets, Github issues, and Community forum posts

IAM-529 fixes #26814

<!-- Include links to **Linear ticket** or Github issue or Community forum post. Important in order to close *automatically* and provide context to reviewers. https://linear.app/n8n/issue/ --> <!-- Use "closes #<issue-number>", "fixes #<issue-number>", or "resolves #<issue-number>" to automatically close issues when the PR is merged. -->

Review / Merge checklist

  • PR title and summary are descriptive. (conventions) <!-- **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** -->
  • Docs updated or follow-up ticket created.
  • Tests included. <!-- A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests. -->
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)
© 2026 · via Gitpulse