how do i create a post request like this in golang


Hi guys a have a question about POST REQUEST

I have a some python code like this
data = {
"name": "Frank",
"age": 21,
"nationality": ["Britan"],

r =‘somesite’, json=data)
How i can make a POST requst similar this on GOLANG, i tried use "nationality": ["Britan"]
but i have a some errors with []
i tried to use map[string]string but ofc its not working
May be i can use some structure to resolve my problem


You should use map[string]interface{} instead of map[string]string

As this link (


where KeyType may be any type that is comparable, and ValueType may be any type at all, including another map!

Your body has both string and slice type, so ValueType is interface{} better than string.

Answered By – nohattee

Answer Checked By – David Marino (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.