Skip to content

Conversation

@tracli
Copy link
Contributor

@tracli tracli commented Jan 22, 2025

Fix issue #63

When unmarshaling relationship data that is the json literal null to an interface, map, pointer, or slice, we should set the value to nil. This is different from the current behavior, which is to assume the value is already nil and do nothing. If unmarshaling to any other type, continue to do nothing.

The motivation for this is to match the behavior of the standard library json package: "The JSON null value unmarshals into an interface, map, pointer, or slice by setting that Go value to nil. Because null is often used in JSON to mean “not present,” unmarshaling a JSON null into any other Go type has no effect on the value and produces no error."

When unmarshaling relationship data that is the json literal null to an interface, map, pointer, or slice, set
the value to nil instead of the current behavior, which is to assume the value is already nil and do nothing.
If unmarshaling to any other type, continue to do nothing.
@tracli tracli marked this pull request as ready for review January 22, 2025 15:48
@Kaycell Kaycell merged commit 055f87a into DataDog:main May 12, 2025
5 checks passed
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.

2 participants