forked from mirror/gjson
parent
9f58baa7a6
commit
bf4efcb3c1
2
gjson.go
2
gjson.go
|
@ -2592,7 +2592,7 @@ func execModifier(json, path string) (pathOut, res string, ok bool) {
|
||||||
// unwrap removes the '[]' or '{}' characters around json
|
// unwrap removes the '[]' or '{}' characters around json
|
||||||
func unwrap(json string) string {
|
func unwrap(json string) string {
|
||||||
json = trim(json)
|
json = trim(json)
|
||||||
if len(json) >= 2 && json[0] == '[' || json[0] == '{' {
|
if len(json) >= 2 && (json[0] == '[' || json[0] == '{') {
|
||||||
json = json[1 : len(json)-1]
|
json = json[1 : len(json)-1]
|
||||||
}
|
}
|
||||||
return json
|
return json
|
||||||
|
|
|
@ -2200,3 +2200,8 @@ func TestIssue195(t *testing.T) {
|
||||||
`**********{**",**,,**,**,**,**,"",**,**,**,**,**,**,**,**,**,**]`
|
`**********{**",**,,**,**,**,**,"",**,**,**,**,**,**,**,**,**,**]`
|
||||||
Get(testJSON, testJSON)
|
Get(testJSON, testJSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue196(t *testing.T) {
|
||||||
|
testJSON := `[#.@pretty.@join:{""[]""preserve"3,"][{]]]`
|
||||||
|
Get(testJSON, testJSON)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue