Skip to content

Commit

Permalink
Merge pull request #3 from hslatman/hs_time-support
Browse files Browse the repository at this point in the history
Add support for parsing of time.Time using Result.Time()
  • Loading branch information
m7shapan authored Sep 26, 2020
2 parents 5e0dd1c + d096135 commit 08aae59
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ func parseStructureType(result gjson.Result, field reflect.Type) (v interface{})
case reflect.Map:
v = unmarshalMap(result.Raw, field)
case reflect.Struct:
v = unmarshalStruct(result.Raw, field)
if field.String() == "time.Time" {
v = result.Time()
} else {
v = unmarshalStruct(result.Raw, field)
}
default:
v = nil
}
Expand Down

0 comments on commit 08aae59

Please sign in to comment.