mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
remove UseNumber for json decoding in package gjson
This commit is contained in:
19
.example/encoding/gjson/issue360.go
Normal file
19
.example/encoding/gjson/issue360.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gogf/gf/encoding/gjson"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := `
|
||||
{"apiVersion":"v1","kind":"Service","metadata":{"labels":{"name":"http-daemon"},"name":"http-daemon","namespace":"default"},"spec":{"ports":[{"name":"http-daemon","port":8080,"protocol":"TCP","targetPort":9212}],"selector":{"app":"http-daemon","version":"v0930-082326"}}}
|
||||
`
|
||||
js, err := gjson.DecodeToJson(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
//g.Dump(js.ToMap())
|
||||
y, _ := js.ToYamlString()
|
||||
fmt.Println(y)
|
||||
}
|
||||
Reference in New Issue
Block a user