From c018850e3490542852d5be37fae966f1a3b5b5eb Mon Sep 17 00:00:00 2001 From: Alex Savin Date: Tue, 8 Jul 2025 22:33:46 -0400 Subject: [PATCH] Fix JSON unmarshalling in CustomTime types to correctly handle escaped quotes --- mysubaru.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysubaru.go b/mysubaru.go index 4d089dc..b9104c5 100644 --- a/mysubaru.go +++ b/mysubaru.go @@ -497,7 +497,7 @@ type CustomTime1 struct { func (ct *CustomTime1) UnmarshalJSON(b []byte) (err error) { // Use the correct layout string for the desired format const layout = "2006-01-02T15:04:05" - s := strings.Trim(string(b), `\\"`) // Remove surrounding quotes + s := strings.Trim(string(b), "\\\"") // Remove surrounding quotes if s == "null" { ct.Time = time.Time{} return nil @@ -515,7 +515,7 @@ type CustomTime2 struct { func (ct *CustomTime2) UnmarshalJSON(b []byte) (err error) { // Use the correct layout string for the desired format const layout = "2006-01-02T15:04:05-0700" - s := strings.Trim(string(b), `\\"`) // Remove surrounding quotes + s := strings.Trim(string(b), "\\\"") // Remove surrounding quotes if s == "null" { ct.Time = time.Time{} return nil