golang how i can get value from []interface {} type

Issue i have var (name result["error_type"]) with type []interface {} and value [map[reason:map[phone:empty] send_at:1.636697291e+09 status:error]] how i cat get value from type []interface {} example result["error_type"]["128"]["reason"]["phone"] this type i got from var result map[string]interface{} json.NewDecoder(r.Body).Decode(&result) r.Body has Json { "offer_name":"EbcBankruptcy",

Continue reading

add colly package output text to map in golang

Issue i was making a web scraper with colly package, where it collects the ContestName and ContestTime from a website and make a json file. so i did like this Contests := make(map[string]map[string]map[string]map[string]string) Contests["AtCoder"] = make(map[string]map[string]map[string]string) Contests["AtCoder"]["FutureContests"] = make(map[string]map[string]string) AtcoderFunc(Contests)

Continue reading

Converting JSON object array to YAML

Issue I have the following json which needs to convert to YAML { “siteidparam”: “lid”, “sites”: [ { “name”: “default”, “routingmethod”: { “method”: “urlparam”, “siteid”: “default”, “urlpath”: “default” } }, { “name”: “csqcentral”, “routingmethod”: { “method”: “urlparam”, “siteid”: “capitolsquare”, “urlpath”:

Continue reading

How can I insert json string to MongoDB?

Issue I have a json string. Like this: "{"http_requests":[{"http_requests":{"code":"400","method":"PUT","value":89}},{"http_requests":{"code":"200","method":"PUT","value":45}}]}" I want to insert this json to mongodb. But I have error in my code. The error is "cannot transform type string to a BSON Document: WriteString can only write while

Continue reading