Getting a value from http request

I'm trying to get a value for example "id" from this site:

http://api.roblox.com/groups/7585110

this is my code:

url := fmt.Sprintf("https://groups.roblox.com/v1//groups/7585110) 
resp, err := http.Get(url)

and then I do:

body, err := ioutil.ReadAll(resp.Body)

and then:

sb := string(body)

so if I want to print the stuff from the website:

fmt.Println(sb)

and I get the following output:

{
    "Name": "Catalysm",
    "Id": 7585110,
    "Owner": {
        "Name": "Scypno",
        "Id": 1590107797
    },
    "EmblemUrl": "http://www.roblox.com/asset/?id=5627136670",
    "Description": "",
    "Roles": [{
        "Name": "Member",
        "Rank": 1
    }, {
        "Name": "Admin",
        "Rank": 254
    }, {
        "Name": "Owner",
        "Rank": 255
    }]
}

but I want to make a variable named "id" to get the following output:

7585110

is that possible? and if so, how?



Read more here: https://stackoverflow.com/questions/66278223/getting-a-value-from-http-request

Content Attribution

This content was originally published by Kaitholen at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: