Skip to content

Fix: JSONSlice stores "null" string instead of SQL NULL when nil#322

Open
dannyota wants to merge 1 commit intogo-gorm:masterfrom
dannyota:fix-jsonslice-nil
Open

Fix: JSONSlice stores "null" string instead of SQL NULL when nil#322
dannyota wants to merge 1 commit intogo-gorm:masterfrom
dannyota:fix-jsonslice-nil

Conversation

@dannyota
Copy link

@dannyota dannyota commented Feb 6, 2026

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Add nil checks to JSONSlice Value(), Scan(), and GormValue() — same pattern already used by JSON (json.go:25) and JSONMap (json_map.go:23) but missing from JSONSlice.

Without this fix, a nil JSONSlice stores the literal string "null" instead of SQL NULL.

User Case Description

Same issue as #99 but for JSONSlice[T].

Fixes #314

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Same "null" value problem like in #99

1 participant