Skip to content

Commit 3e546a2

Browse files
committed
hashmap json unmarshal fix
1 parent 23a8883 commit 3e546a2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tlb/hashmap.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"slices"
8+
"strconv"
89
"strings"
910

1011
"github.com/tonkeeper/tongo/boc"
@@ -745,7 +746,7 @@ func (h *Hashmap[keyT, T]) UnmarshalJSON(data []byte) error {
745746
h.values = make([]T, 0, len(m))
746747
for k, v := range m {
747748
var key keyT
748-
if err := json.Unmarshal([]byte(k), &key); err != nil {
749+
if err := json.Unmarshal([]byte(strconv.Quote(k)), &key); err != nil {
749750
return err
750751
}
751752
h.keys = append(h.keys, key)

tlb/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (h *HashmapE[keyT, T]) UnmarshalJSON(data []byte) error {
156156
hInt.values = make([]T, 0, len(m))
157157
for k, v := range m {
158158
var key keyT
159-
if err := json.Unmarshal([]byte(k), &key); err != nil {
159+
if err := json.Unmarshal([]byte(strconv.Quote(k)), &key); err != nil {
160160
return err
161161
}
162162
hInt.keys = append(hInt.keys, key)

0 commit comments

Comments
 (0)