You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using segmentio's json Unmarshaling to unmarshal data to a struct having field *intjson:"Field,string" `
in its definition , I'm getting field as "null" instead of null if its not there in the data.
The text was updated successfully, but these errors were encountered:
Looking more into this, it appears this is a poorly documented behavior of the standard library, here is what the documentation says:
The "string" option signals that a field is stored as JSON inside a JSON-encoded string. It applies only to fields of string, floating point, integer, or boolean types. This extra level of encoding is sometimes used when communicating with JavaScript programs:
Pointers are not mentioned here.
I'll look into adapting our implementation to match the encoding/json package's behavior tho, it seems important to avoid breaking code that attempts to leverage this package.
While using segmentio's json Unmarshaling to unmarshal data to a struct having
field *int
json:"Field,string" `in its definition , I'm getting field as "null" instead of null if its not there in the data.
The text was updated successfully, but these errors were encountered: