You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
552 B
27 lines
552 B
package main
|
|
|
|
import (
|
|
"dsBaseRpc/Utils/FileUtil"
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/tidwall/gjson"
|
|
)
|
|
|
|
func main() {
|
|
//1、读取json文件
|
|
j := FileUtil.ReadFileContent("e:\\1.json")
|
|
result := gjson.Get(j, "datas")
|
|
for _, r1 := range result.Array() {
|
|
fmt.Println(r1.Get("data_id"))
|
|
fmt.Println(r1.Get("del_flag"))
|
|
re := r1.Get("data")
|
|
jsonStr := re.Str
|
|
var mymap map[string]interface{}
|
|
if err := json.Unmarshal([]byte(jsonStr), &mymap); err == nil {
|
|
for key, value := range mymap {
|
|
fmt.Println(key, ":", value)
|
|
}
|
|
}
|
|
}
|
|
}
|