SmartDateNormalizer returns full field array during per-property denormalization, causing nested data in JSON:API/Entity Share

Created on 4 September 2025, 28 days ago

Problem/Motivation

When using Smart Date with JSON:API (e.g. via Entity Share), SmartDateNormalizer::denormalize() returns the full Smart Date field structure during per-property denormalization.

FieldItemNormalizer expects each property (value, end_value, duration, etc.) to be denormalized independently, but SmartDateNormalizer returns an array of all properties, causing data nesting and unexpected structures.

Example of the resulting $data_internal from FieldItemNormalizer:

array (
  'value' => 
  array (
    'value' => 1760029200,
    'end_value' => NULL,
    'duration' => NULL,
    'rrule' => NULL,
    'rrule_index' => NULL,
    'timezone' => NULL,
  ),
  'end_value' => 
  array (
    'value' => 1760032800,
    'end_value' => NULL,
    'duration' => NULL,
    'rrule' => NULL,
    'rrule_index' => NULL,
    'timezone' => NULL,
  ),
  'duration' => 60,
  'rrule' => NULL,
  'rrule_index' => NULL,
  'timezone' => '',
)

Cause

FieldItemNormalizer calls denormalizers on each property individually.

SmartDateNormalizer::denormalize() assumes it always receives the full SmartDate object and builds an array of all properties.

This mismatch leads to nested/duplicated data.

Proposed Solution

Update SmartDateNormalizer::denormalize() to detect when it is receiving:

A scalar/NULL value (per-property denormalization) β†’ delegate to TimestampNormalizer.

An array/object (whole SmartDate item) β†’ build and return the full property array.

Will have a merge request in soon.

Full Disclosure

I originally reported this at the Entity Share queue - you can see a full write up there πŸ› Nested array values incorrectly processed with smart_date values Active . Assistance with this write up care of ChatGPT.

πŸ› Bug report
Status

Active

Version

4.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pbabin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024