JSON struct tag directives

Report a typo

Match each of the optional JSON struct tag directives with their correct definition.

Match the items from left and right columns
omitempty
-
string
this directive makes that the field is never encoded into JSON
omits a struct field when it contains a zero/default value of its type
forces the data in an individual field to be encoded as a string in the resulting JSON
this directive allows private struct fields to be encoded into JSON
___

Create a free account to access the full topic