I just started leaning Go and I've been stuck on this for a couple of days Running on an App Engine dev server
The idea is to get an object I can work with with a format like this: { "Results": [ { "username": "Test username", "username_sani": "testusername", "dob": "1992-09-10", "email": "", "gender": "M", "account_type": "user", "account_status": "enabled", "activated": 1, "country": "US", "weekly_playtime": "6", "game": [ ], "primary_game": "", "activation_code": "BOxc9P2FomaaL4qKkQ2JMUIa1kgaYCJUlkfUqTs9", "password": "", "last_active": "2016-11-20 20:27:38", "lol": { "verify_string": "ymn8Hm9ojfCzLqgZaZDi" }, "login_history": [ { "date": "2016-11-20 20:03:46", "result": "login_ok", "forward": "", "timezone": -300 } ], "current_login_att": 0, "reset_password_entries": [ { "code": "sZln9bCoLYVrPXErKes5", "valid_till": "2016-11-22 01:10", "result": "cancelled" } } ], "Includes": [], "IsStale": false, "IndexTimestamp": "2016-11-21T16:21:06.5157187Z", "TotalResults": 1, "SkippedResults": 0, "IndexName": "users_search", "IndexEtag": "01000000-0000-0069-0000-00000001AED9", "ResultEtag": "A85E1A89-3C87-F9AA-B0BA-41EC39CD225A", "Highlightings": {}, "NonAuthoritativeInformation": false, "LastQueryTime": "2016-11-22T19:19:39.0784570Z", "DurationMilliseconds": 0, "ScoreExplanations": {}, "TimingsInMilliseconds": {}, "ResultSize": 0 } My current code : ctx := appengine.NewContext(req) client := urlfetch.Client(ctx) // resp,_ := client.Get(ip+"/indexes/"+ query) // doc,_ := ioutil.ReadAll(resp.Body) // resp.Body.Close(); // var index_results IndexResults err := json.Unmarshal(doc,&index_results) if err != nil { log.Println(err) } log.Println(index_results) Struct type IndexResults struct{ Results []byte `json:"Results"` } Which gives me an error : json: cannot unmarshal object into Go value of type uint8 With result {[0]} How can I receive json results with dynamic fields that may or not be there? Do I define a struct for every possible result? Thank you -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.