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 2d7438e commit 7e235e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func (c *Carbon) UnmarshalJSON(b []byte) error {
if c.Error != nil {
return c.Error
}
if len(b) == 0 || string(b) == "null" {

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

0 comments on commit 7e235e0

Please sign in to comment.