I am trying to convert s := '{"selector:"{"Status":"open"}"}'
to type string
, as I need to pass this as an argument to a query using GetQueryResult()
.
I have tried UnescapeString
, it only accepts string as argument:
fmt.Println("args " ,html.UnescapeString(s)
but s
is a Go rune
.
The Go Programming Language Specification
Use string
raw literal back quotes, not rune
literal single quotes.
For example,
package main
import (
"fmt"
)
func main() {
s := `{"selector:"{"Status":"open"}"}`
fmt.Printf("type %T: %s", s, s)
}
Playground: https://play.golang.org/p/lGARb35VHTv
Output:
type string: {"selector:"{"Status":"open"}"}