编辑代码

package main
import (
    "fmt"
    "encoding/json"
)

// type PrivilegeIpAbTest struct {
//     // 迭代域结果
//     IterationResult struct {
//         Show int64 `json:"show,omitempty"`
//     } `json:"ecomlive_pleasurebug,omitempty"`
//     // 反转域结果
//     ReverseResult struct {
//         HideProductTag   bool `json:"hide_product_tag,omitempty"`
//         HidePrivilegeTag bool `json:"hide_privilege_tag,omitempty"`
//     } `json:"ecom,omitempty"`
// }

func main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
    // fmt.Println("Hello JSRUN!   \n\n         - from Golang .")

    var result map[string]interface{}
    jsonStr := "{\"ecomlive_pleasurebug\": {\"show\": 2}, \"ecom\": {\"hide_product_tag\": true, \"hide_privilege_tag\": false}}"
    // jsonStr2 := "{\"ecomlive_pleasurebug\": {\"show\": 2}, \"ecom\": {\"hide_product_tag\": true, \"hide_privilege_tag\": false}}"
    err := json.Unmarshal([]byte(jsonStr), &result)
    fmt.Println(err)
    // fmt.Println(result)

    ecomNs, _ := result["ecom"].(map[string]interface{})

    fmt.Println(ecomNs["hide_product_tag"])
    fmt.Println(ecomNs["hide_privilege_tag"])
}