Skip to content

Commit

Permalink
fix gogf#3253
Browse files Browse the repository at this point in the history
  • Loading branch information
oldme-git committed Jan 9, 2024
1 parent 4f4d2c2 commit 1ddce20
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions encoding/gjson/my_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package gjson

import (
"fmt"
"testing"
)

type TestStruct struct {
Result []map[string]interface{} `json:"result"`
}

func TestA(t *testing.T) {
ts := &TestStruct{
Result: []map[string]interface{}{
{
"Name": nil,
},
},
}
a := New(ts)
fmt.Println(a)
}
6 changes: 5 additions & 1 deletion util/gconv/gconv_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package gconv

import (
"fmt"
"reflect"
"strings"

Expand Down Expand Up @@ -303,8 +304,11 @@ func doMapConvertForMapOrStructValue(in doMapConvertForMapOrStructValueInput) in
)
switch {
case mapKeyValue.IsZero():
if mapKeyValue.IsNil() {
var a = reflect.ValueOf(mapKeyValue)
// mapKeyValue.Kind() == reflect.Interface &&
if a.IsNil() {
// quick check for nil value.
fmt.Println(312321)
mapValue = nil
} else {
// in case of:
Expand Down

0 comments on commit 1ddce20

Please sign in to comment.