Skip to content

Unity SDK 5.1 microservice client deserializes null and absent reference fields to null instead of empty defaults #4756

Description

@allister-beamable

Unity SDK 5.1.0 changed the object fallback of MicroserviceClientHelper.DeserializeResult<T> from JsonUtility.FromJson<T> to SmallerJSON Json.Deserialize<T> (74dcc19).

Expected (5.0.x behavior): response DTO reference fields arriving as explicit JSON nulls deserialize to non-null defaults ("", empty array/list, default-constructed nested object); absent List, nested object, and ContentRef members are also default-constructed. The default microservice response serializer emits unassigned reference fields as explicit nulls (identically on 4.3.8 and current), so every object response takes this shape.

Actual: those members now deserialize to null, causing NullReferenceExceptions in game code written against the 5.0.x guarantees. Affects top-level object responses; the list path is unchanged.

Fix + regression tests: #4755. Additional Unity-runtime tests demonstrating the regression (red on 5.1.x, green at unity-sdk-5.0.1): #4754 (closed, branch microservice-client-null-defaults-tests).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions