Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions typescriptify/typescriptify.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ func (t *TypeScriptify) getJSONFieldName(field reflect.StructField, isPtr bool)
jsonTagParts := strings.Split(jsonTag, ",")
if len(jsonTagParts) > 0 {
jsonFieldName = strings.Trim(jsonTagParts[0], t.Indent)
//`json:",omitempty"` is valid
if jsonFieldName == "" {
jsonFieldName = field.Name
}
}
hasOmitEmpty := false
ignored := false
Expand Down