fix: v2.9.5 (#4503)

This commit is contained in:
hailaz
2025-11-10 21:40:35 +08:00
committed by GitHub
parent fde47e8981
commit 1e3aa5f080
46 changed files with 135 additions and 99 deletions

View File

@ -76,13 +76,23 @@ func NewWithOptions(data any, options Options) *Json {
pointedData = gconv.Interfaces(data)
case reflect.Map:
pointedData = gconv.MapDeep(data, options.Tags)
pointedData = gconv.Map(data, gconv.MapOption{
Deep: true,
OmitEmpty: false,
Tags: []string{options.Tags},
ContinueOnError: true,
})
case reflect.Struct:
if v, ok := data.(iVal); ok {
return NewWithOptions(v.Val(), options)
}
pointedData = gconv.MapDeep(data, options.Tags)
pointedData = gconv.Map(data, gconv.MapOption{
Deep: true,
OmitEmpty: false,
Tags: []string{options.Tags},
ContinueOnError: true,
})
default:
pointedData = data

View File

@ -9,6 +9,7 @@ package gjson
import "github.com/gogf/gf/v2/os/gfile"
// Load loads content from specified file `path`, and creates a Json object from its content.
//
// Deprecated: use LoadPath instead.
func Load(path string, safe ...bool) (*Json, error) {
var isSafe bool

View File

@ -57,7 +57,12 @@ func Decode(content []byte) (map[string]any, error) {
err = gerror.Wrap(err, `yaml.Unmarshal failed`)
return nil, err
}
return gconv.MapDeep(result), nil
return gconv.Map(result,
gconv.MapOption{
Deep: true,
OmitEmpty: false,
ContinueOnError: true,
}), nil
}
// DecodeTo parses `content` into `result`.