fix
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package lzUtils
|
||||
|
||||
import "github.com/bytedance/sonic"
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/bytedance/sonic"
|
||||
)
|
||||
|
||||
func RecursiveParse(data interface{}) (interface{}, error) {
|
||||
switch v := data.(type) {
|
||||
@@ -33,3 +37,20 @@ func RecursiveParse(data interface{}) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ParseJsonResponse 直接解析JSON响应数据
|
||||
// jsonResp: JSON响应数据
|
||||
// Returns: 解析后的数据字节数组
|
||||
func ParseJsonResponse(jsonResp []byte) ([]byte, error) {
|
||||
parseResult, err := RecursiveParse(string(jsonResp))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resultResp, marshalErr := json.Marshal(parseResult)
|
||||
if marshalErr != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resultResp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user