Skip to content

Commit

Permalink
Support decoding json strings containing null #225
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Mar 5, 2024
1 parent 7e235e0 commit 59b34ad
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ func (c *Carbon) UnmarshalJSON(b []byte) error {
if c.Error != nil {
return c.Error
}

if string(b) == "null" || len(b) == 0 {
if len(b) == 0 || string(b) == "null" {
return nil
}
key, value, tz := c.parseTag()
Expand Down

0 comments on commit 59b34ad

Please sign in to comment.