package gmodel import ( "log" "testing" "github.com/tidwall/gjson" ) func TestCase1(t *testing.T) { v := `{"base": {"mobile": "18588505404", "company": "fusen", "last_name": "sm", "first_name": "h", "resetaurant": "boy"}, "sub_status": {"notification_email": {"newseleter": false, "order_update": false}, "notification_phone": {"newseleter": true, "order_update": false}}, "logo_selected": {"logo_url": "https://fusenstorage.s3.us-east-2.amazonaws.com/d163cba052dc03e7684a4fa8574a17c629e08b6cd0f47f9c239866949365f807", "logo_selected_id": 5018, "merchant_category": 10, "template_tag_selected": {"color": [["#25211F"], ["#1E1916"]], "version": "2", "template_tag": "C6", "selected_index": 0}}}` // log.Println(userId, guestId, v) if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() { log.Println(logoSelected) log.Println(logoSelected.Get("version")) if ver := logoSelected.Get("version"); ver.Exists() && ver.String() == versionML { log.Println(ver) } } // gjson.Get(content, "logo_selected") }